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
We need to use the date constructor to create a date, otherwise the
order of invocation of the set methods influences the result leading to
incorrect date values. There is no permutation which is always correct.
Example: 1967-04-01 00:00:00
Depending on the timezone the milliseconds from C# could represent
1967-03-31 23:00:00. If we now set the month to April we get the
31st of April which JavaScript interprets as the 1st of May.
Even if we don't use the current date as starting point but
1970-01-01 00:00:00 using the set methods can lead to errors.
Example: 1972-02-29 00:00:00
Since we start from 1970-01-01 00:00:00 (UTC) which was not a leap year,
we need to set the year first. Otherwise, if we now set the month to
February and the date to 29 we get the 1st of March.
Another case is can occur when changing daylight savings time.
0 commit comments