-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling wrong arguments for digital format #33
Comments
Discussion from 2020-09-10:
|
can someone explain to me what would be expected output of the following let d = {years: 1, months: 2, weeks: 3, days: 4, hours:5, minutes:6, seconds: 7}
let d2 = {hours:5, minutes:6}
let d3 = {minutes:5, seconds:6}
let df1 = new Intl.DurationFormat("en", {style: "digital"})
let df2 = new Intl.DurationFormat("en", {style: "digital", smallestUnit: "seconds", largestUnit: "hours"})
df1.format(d) // line1
df2.format(d) // line2
df1.format(d2) // line3
df2.format(d2) // line4
df1.format(d3) // line5
df2.format(d3) // line6 |
we agreed that I think we kinda slip this part somehow. |
Based on the agreement you said above, what should be the output of let d = {years: 1, months: 2, weeks: 3, days: 4, hours:5, minutes:6, seconds: 7}
let d2 = {hours:5, minutes:6}
let d3 = {minutes:5, seconds:6}
let df1 = new Intl.DurationFormat("en", {style: "digital"})
let df2 = new Intl.DurationFormat("en", {style: "digital", smallestUnit: "seconds", largestUnit: "hours"})
df1.format(d) // line1
df2.format(d) // line2
df1.format(d2) // line3
df2.format(d2) // line4
df1.format(d3) // line5
df2.format(d3) // line6 There are many possibility behavior of interpreting such agreement. Could you write down, based on your understanding of the agreement, what the output should be exactly? |
@FrankYFTang given that we will limit the valid values for |
I cannot tell it would be an issue or not without seeing exactly what the spec text would turn into and what would be the output of
From your understanding of what we already agree upon, what would be the output of these 6 lines? |
Now I am not 100% sure of it myself, given that folks have pointed out "digital" formats that can display units larger than "hours", but given my previous assumption that CLDR only includes data for this format upto "hours", here is the result:
Now this assumes that we expand the current behavior to |
why is the following? that is for {hours:5, seconds:6} not {hours:5, minutes:6}
|
@FrankYFTang oops, sorry, I misread. In that case, it would be
and given my argument about defaults, Now if I understand correctly, your point is that in that case |
@FrankYFTang oh wait that was #54. So this issue basically needs no resolving, it will be resolved automatically when we start rounding things properly. |
I am not asking these 6 lines to make any points here. I just try to understand what will be the output from your agreed changes (since I have no spec text to follow to figure out yet). |
@FrankYFTang right, sorry, I will make the spec text updates as soon as possible while the surrounding questions get answered. |
"wrong" arguments are no longer permitted in the current design. closing. |
For
digital
format we only have limited fields to format and we do not suggest having zero values in the middle, what shall we do in the case of wrong argumentsFor example, if a user wants to format
largestUnit: "days", smallestUnit: "seconds"
in this case, shall we reject or flip to another format such as
short
The text was updated successfully, but these errors were encountered: