ReactDatePicker Day off in Summer time issue
If you’re using react-datepicker
, and the last time you’ve tested your date-picker was in winter time or sooner, please check if your date-picker still works properly.
Issue:
<DatePicker
dateFormat="DD/MM/YYYY"
onChange={val => this.setValue(input, val)}
selected={input.value ? moment(input.value) : null}
/>
Seems pretty basic, right?
Date displayed:
Real value:
Solution:
Add
utcOffset={0}
to props in your react-date-picker.
<DatePicker
dateFormat="DD/MM/YYYY"
onChange={val => this.setValue(input, val)}
selected={input.value ? moment(input.value) : null}
utcOffset={0}
/>
You can read more about this issue Here.
Tweet