-
Notifications
You must be signed in to change notification settings - Fork 9
PartitionDateTimeRangePattern may need additional date-time fields not present in the formatter #21
Comments
Or instead of a whole new separate For example instead of the current:
define it as
and then use the additional fields within |
Hmm, ICU-based implementations can't even guarantee that the interval and non-interval string use the same output format for date-time fields: js> var dtf = new Intl.DateTimeFormat("en", {day: "2-digit", timeZone: "UTC"})
js> dtf.format(0)
"01"
js> dtf.formatRange(0, 24*60*60*1000)
"1 \u2013 2"
So, if we want to specify what's currently implementable using ICU, we need to allow to use different formats for the individual date-time components, which is possible with the proposal outlined in #21 (comment). |
@FrankYFTang Was your comment meant for #22? |
yes, sorry. I put into the wrong issue. Deleted that and added it to #22 |
…e date-range patterns (Issue #21). Together with this, update FormatDateTimePattern to use these options instead of the default options used by date-time formatting.
Thanks @anba for the suggestion, you are right that we are missing these date-time fields that would be necesary to format some of the possible date ranges. I like your proposal as it would allow us to support current ICU behavior without needing to create a new dateTimeFormat in @anba, @FrankYFTang I'd really appreciate if you could take a look at and review #25. Thanks! |
A Firefox user also noticed that the date-time field formats can change depending on the input ranges: https://bugzilla.mozilla.org/show_bug.cgi?id=1659367 |
…e date-range patterns (Issue #21). Together with this, update FormatDateTimePattern to use these options instead of the default options used by date-time formatting.
Example:
The resolved pattern for the
Intl.DateTimeFormatter
only includes[[hour]]
, but to output the range more date-time fields are needed.This can mean two things:
[[rangePatterns]]
to only include fields present in the format fields record.{[[hour]]: "numeric", [[minute]]: "2-digit", [[second]]: "2-digit", [[pattern]]: "{hour}:{minute}:{second}", [[pattern12]]: "{hour}:{minute}:{second} {ampm}"}
can only support ranges in[[rangePatterns]]
which containhour
,minute
, andsecond
.Intl.DateTimeFormat
instance inPartitionDateTimeRangePattern
which supports all fields needed for[[rangePatterns]]
.The text was updated successfully, but these errors were encountered: