如何国际化 React-Dates 月份和工作日名称?

How to internationalize React-Dates Month and weekday names?

我正在使用 react-dates,我正在尝试弄清楚如何国际化月份和工作日名称。我已经想出如何对输入占位符文本执行此操作,但我找不到如何执行此操作。

我给 react-dates 的当前道具 DateRangePicker 看起来像这样:

<DateRangePicker
        startDate={this.state.startDate} // momentPropTypes.momentObj or null,
        endDate={this.state.endDate} // momentPropTypes.momentObj or null,
        onDatesChange={({ startDate, endDate }) => {
            this.setState({ startDate, endDate });
            this.props.onDateChange(this.props.name, startDate, endDate);
          }
        } // PropTypes.func.isRequired,
        focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
        onFocusChange={focusedInput => this.setState({ focusedInput })} // PropTypes.func.isRequired,
        numberOfMonths={1}
        firstDayOfWeek={1}
        minimumNights={0}
        isOutsideRange={(x) => moment().add(1, 'days') < x }
        displayFormat="DD-MM-YYYY"
        showClearDates={true}
        startDatePlaceholderText={this.props.intl.formatMessage({id: 'DATE_PICKER_START_DATE'})}
        endDatePlaceholderText={this.props.intl.formatMessage({id: 'DATE_PICKER_END_DATE'})}
        hideKeyboardShortcutsPanel= {true}
      />

我正在使用 react-intl 进行国际化。

日历是这样的: image of the calendar

基本上我要更改的是月份名称 November 和工作日名称 Mo Tu We Th Fr Sa Su

期望的结果是将它们翻译成芬兰语 -> MarraskuuMa Ti Ke To Pe La Su

我设法通过使用芬兰语导入时刻和日期选择器的一些额外道具来解决这个问题:

import React, { Component } from "react";
import {DateRangePicker} from 'react-dates';
import { injectIntl, intlShape } from "react-intl";
import moment from 'moment'
import 'moment/locale/fi';
import 'react-dates/initialize';
import 'react-dates/lib/css/_datepicker.css';

.
.
.

<DateRangePicker
    .
    .
    .
    renderMonthText={month => {
      month.locale(this.props.intl.locale)
      return(
        moment(month).format('MMMM YYYY')
      )
    }}
    renderDayContents={day => {
      day.local(this.props.intl.local)
      return(
        moment(day).format('D')
      )
    }}
  />