-
Notifications
You must be signed in to change notification settings - Fork 10
Indexing month names for leap month #55
Comments
A snag in the Hebrew calendar: the digits used to represent months map to different strings each year. For example: new Date(2018, 2, 20).toLocaleDateString("en-US-u-ca-hebrew", { month: "long", day: "numeric" })
"Nisan 4"
new Date(2019, 2, 20).toLocaleDateString("en-US-u-ca-hebrew", { month: "long", day: "numeric" })
"Adar II 13"
new Date(2018, 2, 20).toLocaleDateString("en-US-u-ca-hebrew", { month: "numeric", day: "numeric" })
"7/4"
new Date(2019, 2, 20).toLocaleDateString("en-US-u-ca-hebrew", { month: "numeric", day: "numeric" })
"7/13" |
This is still a really important open question. We are exploring options in the Temporal repository at tc39/proposal-temporal#290 because it would be nice for the Temporal month and Intl.DisplayNames month to match. Can we recommend that when browsers ship this feature, they hold back on shipping the month and maybe also weekday types for the time being until we have this issue resolved? |
If that's going to be a request, that seems like a reason not to request stage 3 until it's resolved. |
This proposal is already Stage 3 unfortunately. The issue about leap months came up after we had asked for Stage 3. In any case, I do not want to block the rest of the proposal on this edge case, since the rest of it is really solid and unlikely to be affected by our decision on month names. |
Oh, my mistake, I thought this was Temporal :-) in that case that does make sense to either ask implementers to partially ship, or to drop it back to stage 2. |
Per today's ECMA-402 meeting, we are removing all date/time types from Intl.DisplayNames and saving them for V2, once Temporal has set the precedent. I expect these to be added in a follow-on proposal or PR later in 2020. |
I'm going to keep the conversation going here, since we do need to resolve this issue for both Temporal and DisplayNames, and I would like it to be resolved in 2020. Background: Many lunisolar calendars have the concept of "leap months", which are extra months added to a year in order to maintain rough alignment between moon cycles and solar years. In the Hebrew and Chinese lunisolar calendars, an existing month is "duplicated". For example, in Hebrew, the last month, "Adar", is duplicated into "Adar I" and "Adar II". In the Chinese calendar, the duplicated month could be any of the months, not just the last month; according to Wikipedia:
Here are some options on how to identify the month:
Thoughts? |
Additional ideas from discussion with @FrankYFTang and @echeran:
Also consider making the Temporal Chinese date return a half number like 4.5 for leap month 4. |
As posted in tc39/proposal-temporal#573: I am increasingly liking the idea of passing a proper YearMonth into Intl.DisplayNames. A YearMonth unambiguously says what calendar system and which month in which year you want to format. So for example, to get Ayar II, you could do: const names = new Intl.DisplayNames("en-US", { type: "month" });
const ayarII = names.of(Temporal.YearMonth.from({
calendar: "hebrew",
year: 5779,
month: 7,
});
console.log(ayarII); // "Ayar II" |
I put together a v2 repo on https://github.com/FrankYFTang/intl-displaynames-v2/ please move the future discussion there. |
This proposal reach stage 4 in TC39 2020 Sept meeting. Close this issue in this repo, move all discussion to tc39/proposal-intl-displaynames-v2#11 please |
I was talking to @pedberg-icu yesterday about how to index month names for the purpose of the Intl.DisplayNames API. He suggested that it could make sense to add an optional second argument to the
.of()
method fortype: "month"
to indicate whether the month is a leap-month. Opening an issue to continue this discussion.The text was updated successfully, but these errors were encountered: