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
On the 5-digit year point: while most cases are limited to 4-digit years, Wikibase supports date far in the past and the future (example), so this lib should probably do what it can to support it
to which I replied
Sure! But the point I'm referring to is the check you make by converting the time to an ISO string. I understand 5-digit years would fail there (you're already skipping this check for years longer than 5 digits).
I think we were misunderstanding each other because of browser differences. Whereas new Date('12021') (a 5-digit year) fails in my Firefox 89 console, it doesn't fail in my Chrome 91 console. That is, whereas new Date seems to support 6-digit years up to 275760 in Chrome (see here), it seems to support years up to 9999 in Firefox (see here). MDN warns about these browser differences and inconsistencies, and discourages parsing of date strings with the Date constructor.
To fix this we could either:
only try parsing 4-digit years or below, or
check whether new Date(99999) works to decide whether a 4- or 5-digit year threshold should be used.
What do you think?
The text was updated successfully, but these errors were encountered:
In PR #68 I commented
to which @maxlath replied
to which I replied
I think we were misunderstanding each other because of browser differences. Whereas
new Date('12021')
(a 5-digit year) fails in my Firefox 89 console, it doesn't fail in my Chrome 91 console. That is, whereasnew Date
seems to support 6-digit years up to 275760 in Chrome (see here), it seems to support years up to 9999 in Firefox (see here). MDN warns about these browser differences and inconsistencies, and discourages parsing of date strings with the Date constructor.To fix this we could either:
new Date(99999)
works to decide whether a 4- or 5-digit year threshold should be used.What do you think?
The text was updated successfully, but these errors were encountered: