As discussed in #170, certain combinations of "display" settings in numeric styles can result in output that's both unclear and awkward. Consider the output from this sequence of formatted durations:
This problem arises when there is a unit with style"numeric" or "2-digit", display: "auto", and 0 for its value between two nonzero"numeric"/"2-digit"-styled units. Currently this can only happen when the minutes unit is 0 and "auto", though there would be other contexts where this problem would arise if the "numeric" format were allowed for additional units in a future DFv2.
This PR takes a couple of steps to ensure that "numeric"/"2-digit" formatting produces more regular results:
When units within a duration are "numeric"/"2-digit"-styled without explicitly being set to "numeric"/"2-digit", the default display settings for minutes and seconds are now "always" instead of "auto"
In the interest of never formatting "numeric"/"2-digit" formatted durations as comma-separated lists of one item each, when a "numeric"/"2-digit"-styled unit appears between two other actually displayed "numeric"/"2-digit"-styled units, that middle unit is displayed even if it is 0 and even if the display option for that unit is set to "auto".
As discussed in #170, certain combinations of
"display"
settings in numeric styles can result in output that's both unclear and awkward. Consider the output from this sequence of formatted durations:This problem arises when there is a unit with
style
"numeric"
or"2-digit"
,display: "auto"
, and 0 for its value between two nonzero"numeric"
/"2-digit"
-styled units. Currently this can only happen when the minutes unit is0
and"auto"
, though there would be other contexts where this problem would arise if the"numeric"
format were allowed for additional units in a future DFv2.This PR takes a couple of steps to ensure that
"numeric"
/"2-digit"
formatting produces more regular results:"numeric"
/"2-digit"
-styled without explicitly being set to"numeric"
/"2-digit"
, the defaultdisplay
settings for minutes and seconds are now"always"
instead of"auto"
"numeric"
/"2-digit"
formatted durations as comma-separated lists of one item each, when a"numeric"
/"2-digit"
-styled unit appears between two other actually displayed"numeric"
/"2-digit"
-styled units, that middle unit is displayed even if it is0
and even if thedisplay
option for that unit is set to"auto"
.