-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Labels
DataRelated to locale dataRelated to locale dataSmallSmaller change solvable in a Pull RequestSmaller change solvable in a Pull Requestc: datetimeComponent: dates, times, timezonesComponent: dates, times, timezoness: help wantedStatus: help wanted; needs proposal championStatus: help wanted; needs proposal champion
Milestone
Description
[...] because CLDR/ICU may give different field widths for different hour-cycles. For example, hour is "numeric" for "h12", but "2-digit" for "h23" for "en".
Hmm, this actually already a problem in the main ECMA-402 spec when compared to what's implemented in engines:
js> new Date("2020-01-01T01:02:03").toLocaleString("en-u-hc-h12")
"1/1/2020, 1:02:03 AM"
js> new Date("2020-01-01T01:02:03").toLocaleString("en-u-hc-h23")
"1/1/2020, 01:02:03"
Per spec it is illegal to format hour
once as "1"
and another time as "01"
. So I think you can punt on the issue about different field widths for [[pattern]]
and [[pattern12]]
, and use this record structure:
[[short]]: {
[[pattern]]: "{hour}:{minute}",
[[pattern12]]: "{hour}:{minute} {ampm}",
[[hour]]: "2-digit",
[[minute]]: "2-digit",
}
Originally posted by @anba in tc39/proposal-intl-datetime-style#45 (comment)
sffc
Metadata
Metadata
Assignees
Labels
DataRelated to locale dataRelated to locale dataSmallSmaller change solvable in a Pull RequestSmaller change solvable in a Pull Requestc: datetimeComponent: dates, times, timezonesComponent: dates, times, timezoness: help wantedStatus: help wanted; needs proposal championStatus: help wanted; needs proposal champion