-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect handling of years 0000-0099 #51
Comments
We are facing this issue and searching for a workaround.
Display of years on four digits can also be fixed with leading zero with help of the String.padStart method for example. |
For anyone facing this issue, it seems the following patch works in my case. Could also be a starting point to propose a PR to dayzed library.
|
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a number of places in
utils.js
where you callnew Date(year, month, day)
. There is a documented issue with the JavaScript Date constructor where year values from 0-99 are interpreted as a relative offset from the year 1900. See this MDN article:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years
The result is that if we pass a year in this range to useDayzed, the calendar shows (for example) 1999 instead of 0099.
Admittedly, it's pretty unlikely that real users will be working with years in this range - we only ran across the problem because we were testing extreme values. But I thought you should be aware that this issue exists.
The text was updated successfully, but these errors were encountered: