-
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
fixup explainer and update to latest design #66
Conversation
697062b
to
b941a11
Compare
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a section explaining the motivation and design for the fractionalDigits
option. Also a section for the style
option.
Finally, I was hoping to see an "Options Summary" or "Design Summary" section that shows the full list of options and their allowed values. The current layout of the page with multiple, separate "Design" sections is fine, but it makes it visualize every option to understand the big picture of how the API works. I think both are helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new fractionalDigits
section with examples is great. But IMHO this page still needs an options summary section which lists all the possible options, their possible values, and a short sentence about each one. Something like the "parameters" section of https://tc39.es/proposal-temporal/docs/zoneddatetime.html#until.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justingrant updated! Please check out the README now and let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New content is much clearer and easier to understand. Thanks!
spec.emu
Outdated
<li>[[MonthsDisplay]] is one of the String values `"auto"` or `"always"` identifying when to display the months field.</li> | ||
<li>[[Weeks]] is one of the String values `"long"`, `"short"`, or `"narrow"` identifying the formatting style used for the weeks field.</li> | ||
<li>[[WeeksDisplay]] is one of the String values `"auto"` or `"always"` identifying when to display the weeks field.</li> | ||
<li>[[Days]] is one of the String values `"long"`, `"short"`, or `"narrow"` identifying the formatting style used for the days field.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should consider supporting a 'numeric'
style for days
. I've seen countdown timers that add days to the left of hours, e.g. 2:23:59:59.123456789
.
spec.emu
Outdated
@@ -331,7 +405,26 @@ contributors: Ujjwal Sharma, Younies Mahmoud | |||
<li>[[DataLocale]] is a String value with the language tag of the nearest locale for which the implementation has data to perform the formatting operation. It will be a parent locale of [[Locale]].</li> | |||
<li>[[NumberingSystem]] is a String value with the `"type"` given in Unicode Technical Standard 35 for the numbering system used for formatting.</li> | |||
<li>[[Style]] is one of the String values `"long"`, `"short"`, `"narrow"`, or `"digital"` identifying the duration formatting style used.</li> | |||
<li>[[Fields]] is a List value specifying which duration fields are required to be printed.</li> | |||
<li>[[Years]] is one of the String values `"long"`, `"short"`, or `"narrow"` identifying the formatting style used for the years field.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is fractionalDigits
option?
Thanks @sffc and @justingrant. |
@justingrant does this note seem good? |
Text for |
@justingrant this should do it, right? Seems like the explainer is good to go, would you mind if I extracted the spec commits from this and merged the explainer? |
I'd prefer to see an options summary section added (see #66 (comment)) before merging the new explainer. I think removing the spec updates to a separate PR makes sense to iterate on both in parallel. |
@justingrant could you check it out now and let me know how it looks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the new reference section, because it helps highlight some possible disconnects. Lots of comments below!
README.md
Outdated
* `minutesDisplay` (`String`): When to display minutes. `"auto"` means that minutes won't be displayed if they are zero. Can be either `"always"` or `"auto"`. Defaults to `"auto"` if `minutes` is `undefined` and `"always"` otherwise. | ||
* `seconds` (`String`): The style to be used for formatting seconds. Can be one of `"long"`, `"short"`, or `"narrow"`. Defaults to the value of `style`. | ||
* `secondsDisplay` (`String`): When to display seconds. `"auto"` means that seconds won't be displayed if they are zero. Can be either `"always"` or `"auto"`. Defaults to `"auto"` if `seconds` is `undefined` and `"always"` otherwise. | ||
* `milliseconds` (`String`): The style to be used for formatting milliseconds. Can be one of `"long"`, `"short"`, or `"narrow"`. Defaults to the value of `style`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect some discussion here (and in the microseconds and nanoseconds docs below) about:
- when ms/μs/ns values will be displayed as decimals after
seconds
(or after milliseconds or microseconds for smaller units) and when they'll be displayed as standalone values like "123 ms". - how
fractionalDigits
affects display of ms/μs/ns units - whether trailing zeroes are shown or hidden by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New content looks really good. Makes it much easier to understand, and also easy to highlight a small number of things that I commented on. I didn't review the spec yet but can do that once the explainer content is revised.
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New content is much clearer and easier to understand. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explainer text looks great, modulo a few minor comments I added. I moved on to review the spec and it looks like a few things are missing there, e.g. fractionalDigits, the numeric->2-digit upgrade, defaults for digital style (maybe), etc.
spec.emu
Outdated
@@ -331,7 +445,26 @@ contributors: Ujjwal Sharma, Younies Mahmoud | |||
<li>[[DataLocale]] is a String value with the language tag of the nearest locale for which the implementation has data to perform the formatting operation. It will be a parent locale of [[Locale]].</li> | |||
<li>[[NumberingSystem]] is a String value with the `"type"` given in Unicode Technical Standard 35 for the numbering system used for formatting.</li> | |||
<li>[[Style]] is one of the String values `"long"`, `"short"`, `"narrow"`, or `"digital"` identifying the duration formatting style used.</li> | |||
<li>[[Fields]] is a List value specifying which duration fields are required to be printed.</li> | |||
<li>[[YearsStyle]] is one of the String values `"long"`, `"short"`, or `"narrow"` identifying the formatting style used for the years field.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is fractionalDigits?
spec.emu
Outdated
1. Set _stylesList_ to the list-concatenation of _stylesList_ and « "2-digit" ». | ||
1. Let _style_ be ? GetOption(_options_, _unit_, _stylesList_, *undefined*). | ||
1. If _style_ is *undefined*, then | ||
1. Set _style_ to _baseStyle_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if baseStyle is digital?
spec.emu
Outdated
|
||
<emu-alg> | ||
1. Let _stylesList_ be the List « `"long"`, `"short"`, `"narrow"` ». | ||
1. If _unit_ is one of `"hours"`, `"minutes"`, `"seconds"`, `"milliseconds"`, `"microseconds"`, or `"nanoseconds"`, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does the upgrade from numeric to 2-digit happen?
spec.emu
Outdated
<p>The GetUnitOptions abstract operation is called with the arguments _unit_ (which must be a String), _options_ (which must be an Object) and _baseStyle_ (which must be a String) and returns a Record containing the relevant options for that unit. The following steps are taken:</p> | ||
|
||
<emu-alg> | ||
1. Let _stylesList_ be the List « `"long"`, `"short"`, `"narrow"` ». |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with weird styles, e.g. {hours: numeric, minutes: 'long'}
. Error? Does "long" get upgraded to 2-digit? Something else?
@justingrant do you think it's okay to merge this if I take the spec changes out and file a different PR for them? |
I'm OK with splitting into different PRs, but there are still two outstanding comments on the explainer content that probably should be addressed before merging. |
@justingrant does the explainer look good to go now? |
@justingrant can I merge this now? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for doing all the explainer fixes, we caught and resolved some useful things.
/cc @justingrant @sffc @FrankYFTang