Datetimepicker localization
How can i localize this datetimepicker?
The Moment library have a localization features.
var moment = require('moment'); moment.locale(Your lang);
I tried russian locale with moments.js, locale is changed as I can see in console.log, but Datetimepicker is not localized: weeks start from Sunday, months names are in english and time is 12 hours format (not 24 hours).
var React = require('react');
var ReactDOM = require('react-dom');
var DateTimeField = require('react-bootstrap-datetimepicker');
var moment = require('moment');
require('moment/locale/ru');
console.log(moment.locale());
var h1 = React.createElement('h1', {className: 'header', key: 'header'}, 'This is React');
var p = React.createElement('p', {className: 'content', key: 'content'}, "This is datapicker");
var dateTimeFieldEl = React.createElement(DateTimeField, {
dateTime: "2015-01-01",
format: "YYYY-MM-DD",
viewMode: "date",
inputFormat: "DD/MM/YYYY hh:mm",
className: 'date1',
key: 'date1'
});
var reactFragment = [h1, p, dateTimeFieldEl];
var section = React.createElement('section', {className: 'container'}, reactFragment);
ReactDOM.render(section, document.getElementById('react-application'));
when I change to german with moment.locale('de') the months are correctly localized but the weekdays not
when I use
moment.locale('de', {
weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_')
})
not even the months are localized
with the way @barbalex stated, I still cannot get it working.
turns out the weekdays displayed are hard coded in ./lib/DateTimePickerDays.js
SO I decided to change that into this.props.viewDate._locale._weekdaysMin[X] manually
then it worked