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

add a new "YY" (uppercase yy) parsing option to strictly parse two digit year #1162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanielWeigl
Copy link

@DanielWeigl DanielWeigl commented Mar 19, 2022

the current lowercase "yy" also accepts 4-digits, which fails if the date has no separators and other not-strict length tokens in it.

eg. the date "22031609025910" fails to parse with "yyMMddHHmmssuu" -> reason: "unit out of range", explanation: "you specified 31 (of type number) as a month, which is invalid"

This commit adds a new token "YY" (in addition to the lowercase "yy") which strictly limits the parser to 2 digit years. Also adds a test.

Request for Feedback: also add uppercase variants for the other token settings, so that it is more coherent?

…git year

the current lowercase "yy" also accepts 4-digits, which fails if the date has no separators and other not-strict length tokens in it.

eg. the date "22031609025910" fails to parse with "yyMMddHHmmssuu" -> reason: "unit out of range", explanation: "you specified 31 (of type number) as a month, which is invalid"
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 19, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@icambron
Copy link
Member

good question. I don't like YY, but I also don't have a better idea. yyy is free, but that's also confusing. Let me think on this; I agree that Luxon should support this

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

Successfully merging this pull request may close these issues.

2 participants