-1

我正在尝试将我的更改<DateRangePicker/>为德语。我究竟做错了什么?

render(){
          moment.locale('de')

return(
                        <DateRangePicker
                                              startDate={this.state.startDate} // momentPropTypes.momentObj or null,
                                              endDate={this.state.endDate} // momentPropTypes.momentObj or null,
                                              onDatesChange={({ startDate, endDate }) => {

                                                this.setState({ endDate, startDate,
                                                  startDateString: startDateString,
                                                  endDateString: endDateString})}} // PropTypes.func.isRequired,
                                              focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
                                              onFocusChange={focusedInput => this.setState({ focusedInput }) } // PropTypes.func.isRequired,
                                              endDatePlaceholderText={"Bis"}
                                              startDatePlaceholderText={"Ab"}
                                              displayFormat={"DD/MM/YYYY"}
                                              showDefaultInputIcon={false}
                                          />
)
}
4

2 回答 2

1

要为 设置语言react-dates,有两种方法:

1.

import moment from 'moment';
componentDidMount() {
  moment.locale('ge');
}
  1. import 'moment/locale/ge'
于 2019-11-08T02:52:55.660 回答
-1

确保在你的 npm moment js 中有并将其导入到该 datepicker 的组件中

于 2019-02-15T12:55:23.143 回答