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

Fix two digit year parsing with YYYY format #2494

Closed
wants to merge 1 commit into from

Conversation

sjmeverett
Copy link

Further to the discussion in #2344, this PR provides an alternative way to fix #2343.

I've had to delete one of the existing tests to get this to pass -- it seems that although a couple of people have agreed that the behaviour described in #2343 is unwanted, there was actually a test there to make sure it happened.

@mattjohnsonpint
Copy link
Contributor

Could you please rebase to squash the extra commits into the first one? Thanks.

Two digit years will use the parseTwoDigitYear function when parsing with the YYYY format.
Closes moment#2343
@ichernev ichernev added this to the 2.10.5 milestone Jul 26, 2015
@ichernev
Copy link
Contributor

Merged in 768cfcc

@ichernev ichernev closed this Jul 26, 2015
ichernev added a commit that referenced this pull request Jul 26, 2015
Fix two digit year parsing with YYYY format
@mateusmeloxyz
Copy link

mateusmeloxyz commented Jan 5, 2022

@sjmeverett
@mattjohnsonpint
@ichernev
This change creates an unwanted behavior when a year beginning with 00 is received. For example, the year 0021 get's converted to 2021 when trying to format it with YYYY, and the year 0098 is converted to 1998. Is there any way on which I can avoid this conversion on this specific cases? I would like to have the years as they are: 0098 or 0021. Thanks!

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 this pull request may close these issues.

There doesn't seem to be a way to handle either 2 or 4 digit years
4 participants