Skip to content

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
Contributor

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