You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this is working as intended. Durations are millisecond counts, they do not understand the concept of days, a "day" is just 86400000 milliseconds. Local time-zone DateTime objects have hours, minutes, etc. too, even if they are zero.
And they're subject to local daylight saving changes to time zones.
Use UTC-dates when you want to represent calendar days.
This code prints a wrong value 2021-10-31 instead of the correct value that would be 2021-11-1.
void main() {
DateTime date = DateTime.parse("2021-10-25");
DateTime date2 = date.add(Duration(days: 7));
print(date2);
}
I tried with other similar dates as "2021-01-25" and it works perfectly but not for the one I mentioned above.
The text was updated successfully, but these errors were encountered: