tc39 / proposal-intl-duration-format

https://tc39.es/proposal-intl-duration-format
MIT License
165 stars 18 forks source link

conflict between style 'numeric' and display 'always' in sub seconds fields #142

Closed FrankYFTang closed 1 year ago

FrankYFTang commented 1 year ago

Should we throw in constructor while we have the following combination?

{millisecondsStyle: 'numeric', millisecondsDislay: 'always'} {microsecondsStyle: 'numeric', microsecondsDislay: 'always' } {nanosecondsStyle: 'numeric', nanosecondsDislay: 'always' }

If these styles are 'numeric', then that will be always displayed as fractional of seconds but not in their own unit, right? so in a sense, they will be NEVER displayed.

For example, we will never see a formatToParts result have those unit , right?

ryzokuken commented 1 year ago

That is correct, the numeric style overrides the display strategy for these units so setting both options at the same time doesn't make sense (see my comment in #139). One way to solve this is to disallow *secondsDisplay being set to "always" for these styles.

FrankYFTang commented 1 year ago

this is somehow overlap and therefore dup of https://github.com/tc39/proposal-intl-duration-format/issues/139