[英]How to change react-dates datepicker's language to German?
I'm trying to change my <DateRangePicker/>
to German.我正在尝试将我的
<DateRangePicker/>
更改为德语。 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:要为
react-dates
设置语言,有两种方法可以做到:
1. 1.
import moment from 'moment';
componentDidMount() {
moment.locale('ge');
}
import 'moment/locale/ge'
确保在你的 npm moment js 中有并将其导入到该 datepicker 的组件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.