Open saidhappy010 opened 5 years ago
some +1
same for me
+1
I have the same issue. Can anybody help?
Okay, I found solution.
At first try this before date changing:
var _date = new Date(date);
_date.setMinutes( _date.getMinutes() - _date.getTimezoneOffset());
And then if u still will have wrong dates, try this:
constructor(props) {
super(props);
this.state = {
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60
}
}
<DatePicker
....
timeZoneOffsetInMinutes={this.state.timeZoneOffsetInHours * 60}
....
As I understood the main problem in react native, this is an old date bug.
+1
@wedusa thanks for your solution save a lot of time for me.
By the way was the only valid solution that I find.
Issue
datepicker displays the previous date with certain years
Expected Behavior
As I mention in the title, datepiker displays the date or the previous day with certain years, like 1980, 1881 and other I do not know how much. The problem is: I have a date of birth 01/01/1981. when I click on the date to modify it, the calendar appears with the date of yesterday like that 31/12/1980 instead of 01/01/ 1981. And the same thing with the year 1980. but for example with the year 2009 it works well without any problem. how can I fix this problem