Skip to content

Commit

Permalink
Always use locale() with moment.format()
Browse files Browse the repository at this point in the history
Fix #509
  • Loading branch information
gpbl committed Nov 24, 2017
1 parent c0216b9 commit a0ec735
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/DayPickerInput.js
Expand Up @@ -290,7 +290,7 @@ export default class DayPickerInput extends React.Component {
return;
}

const m = moment(day);
const m = moment(day).locale(dayPickerProps.locale);
const value = m.format(typeof format === 'string' ? format : format[0]);
this.setState({ value, month: day }, () => {
if (onDayChange) {
Expand All @@ -317,7 +317,12 @@ export default class DayPickerInput extends React.Component {
if (dayPickerProps.todayButton) {
// Set the current day when clicking the today button
onTodayButtonClick = () =>
this.updateState(new Date(), moment().format(this.props.format));
this.updateState(
new Date(),
moment()
.locale(dayPickerProps.locale)
.format(this.props.format)
);
}
const Overlay = this.props.overlayComponent;
return (
Expand Down

0 comments on commit a0ec735

Please sign in to comment.