Skip to content

Commit ad5dba1

Browse files
committed
Compensate for timezones by setting hour = 12 (#245)
1 parent 0907e62 commit ad5dba1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/CalendarStrip.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ class CalendarStrip extends Component {
194194
//Function that checks if the locale is passed to the component and sets it to the passed date
195195
setLocale = date => {
196196
let _date = date && moment(date);
197-
if (this.props.locale && _date) {
198-
_date = _date.locale(this.props.locale.name);
197+
if (_date) {
198+
_date.set({ hour: 12}); // keep date the same regardless of timezone shifts
199+
if (this.props.locale) {
200+
_date = _date.locale(this.props.locale.name);
201+
}
199202
}
200203
return _date;
201204
}

0 commit comments

Comments
 (0)