Skip to content

toLocaleString for PlainMonthDay and PlainYearMonth throws #182

Answered by ptomato
mrcljx asked this question in Q&A
Discussion options

You must be logged in to vote

This is by design — the reason it's inconsistent is because you can convert a PlainDate from one calendar system to another, but not a PlainYearMonth or PlainMonthDay. At least, not without additional information (like, supplying the missing day-of-month for PlainYearMonth or year for PlainMonthDay.) It's true that "iso8601" to "gregory" is one of the few cases where you can just map the ISO reference date onto the Gregorian reference date and it will be correct. But if we allowed that for certain calendar pairs, we'd have the problem that toLocaleString() might work for a developer converting ISO to Gregorian, but throw for a user whose locale had a different calendar selected.

The simpl…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mrcljx
Comment options

Answer selected by mrcljx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants