Closed ben-allen closed 7 months ago
Added the padding for the fractional components -- good catch!
With regard to testing for "fractional"
style: The "fractional"
style is never directly used by users, who only have "numeric"
available, and so we don't need to have tests for it. The internal-use-only "fractional"
style exists for a couple of different reasons:
"numeric"
style means two dramatically different things, depending on the unit to which it's applied. If the unit is hours, minutes, or seconds, it means something like "format this as on a digital clock", when it's a subsecond unit it means "make this a fractional component of the previously displayed unit". Using the name "fractional"
simplifies the logic for formatting numeric units, particularly once https://github.com/tc39/proposal-intl-duration-format/pull/188 lands"fractional"
an actual user-specifiable style rather than just something for internal use would be necessary.
If
microseconds
are the firstnumeric
-styled unit, they should be displayed as a fractional component of milliseconds. Likewise, ifnanoseconds
is the firstnumeric
-styled unit, they should be displayed as a fractional component of microseconds.