I'm trying to change my <DateRangePicker/>
to German. What am I doing wrong?
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}
/>
)
}
To set language for react-dates
, there are 2 ways to do it:
1.
import moment from 'moment';
componentDidMount() {
moment.locale('ge');
}
import 'moment/locale/ge'
确保在你的 npm moment js 中有并将其导入到该 datepicker 的组件中
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.