Skip to content
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

Years below 100 not allowed? #87

Closed
donaldpipowitch opened this issue Oct 7, 2020 · 8 comments · Fixed by #170
Closed

Years below 100 not allowed? #87

donaldpipowitch opened this issue Oct 7, 2020 · 8 comments · Fixed by #170

Comments

@donaldpipowitch
Copy link

Hi! Not sure if this is a bug or "intended"/due to some date quirks, but I can't use a year below 100.

zonedTimeToUtc('0100-01-01', 'Europe/Berlin').toISOString()
// === "0099-12-31T23:06:32.000Z"

zonedTimeToUtc('0099-01-01', 'Europe/Berlin').toISOString()
// === "-001801-01-01T23:06:32.000Z"
@marnusw
Copy link
Owner

marnusw commented Oct 7, 2020

Certainly not intentional. I can't guarantee that I'll be able to look at this any time soon since it seems like quite an edge case. I'd welcome a PR though. You can also check the date-fns library directly to see if they support it, because the toDate function was copied from date-fns some versions ago.

@donaldpipowitch
Copy link
Author

Thanks for the quick reply.

@make-github-pseudonymous-again
Copy link
Contributor

@make-github-pseudonymous-again
Copy link
Contributor

Note that there used to be a similar bug in date-fns but it has been fixed a long time ago (November 2016).

@make-github-pseudonymous-again
Copy link
Contributor

I get the following output on runkit (date-fnsv2.28.0, date-fns-tzv1.3.0):

zonedTimeToUtc('0099-01-01', 'Europe/Berlin').toISOString()
"1998-12-31T23:00:00.000Z"

@make-github-pseudonymous-again
Copy link
Contributor

Just wrote a draft PR #170 fixing this issue.

@marnusw
Copy link
Owner

marnusw commented Mar 31, 2022

Released in v1.3.2.

@marnusw
Copy link
Owner

marnusw commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants