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

Error in function toISOString() when 0 year #3765

vagsa2 opened this Issue Feb 15, 2017 · 2 comments


None yet
2 participants

vagsa2 commented Feb 15, 2017

Description of the Issue and Steps to Reproduce:

In the Standard ECMA-262 we can find condition for extended year format before 0 or after 9999. But in moment.js realization condition is 0 < m.year() && m.year() <= 9999.

I think, the right condition is 0 <= m.year() && m.year() <= 9999

var date = moment('0000-01-01T21:00:00.000Z')
date.toISOString() // returns "+000000-01-01T21:00:00.000Z"
date.toDate().toISOString() // returns "0000-01-01T21:00:00.000Z"

This comment has been minimized.


icambron commented Feb 20, 2017



This comment has been minimized.


icambron commented Mar 8, 2017

Closing in favor of #3780

@icambron icambron closed this Mar 8, 2017

ichernev added a commit that referenced this issue Mar 11, 2017

Merge pull request #3780 from marwahaha:patch/3765
[bugfix] Fixes #3765: Ensure year 0 is formatted with YYYY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment