Skip to content

Commit

Permalink
updated GetDurationUnitOptions to use new "fractional" style
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-allen committed Jan 13, 2024
1 parent f2a48d4 commit 9730552
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 5 additions & 5 deletions index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,30 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. Set _displayDefault_ to *"auto"*.
1. Set _style_ to _digitalBase_.
1. Else,
1. If _prevStyle_ is *"numeric"* or *"2-digit"*, then
1. If _prevStyle_ is *"fractional"*, *"numeric"* or *"2-digit"*, then
1. If _unit_ is not one of *"minutes"* or *"seconds"*, then
1. Set _displayDefault_ to *"auto"*.
1. Set _style_ to *"numeric"*.
1. If _unit_ is one of *"milliseconds"*, *"microseconds"*, or *"nanoseconds"*, then
1. Set _style_ to *"fractional"*.
1. Else,
1. Set _style_ to *"numeric"*.
1. Else,
1. Set _displayDefault_ to *"auto"*.
1. Set _style_ to _baseStyle_.
1. Else if _style_ is *"numeric"* and _unit_ is one of *"milliseconds"*, *"microseconds"*, or *"nanoseconds"*, then
1. Else if _style_ is *"fractional"*, then
1. Set _displayDefault_ to *"auto"*.
1. Let _displayField_ be the string-concatenation of _unit_ and *"Display"*.
1. Let _display_ be ? GetOption(_options_, _displayField_, ~string~, « *"auto"*, *"always"* », _displayDefault_).
1. If _display_ is *"always"* and _style_ is *"fractional"*, then
1. Throw a *RangeError* exception.
1. If _prevStyle_ is *"fractional"*, then
1. If _style_ is not *"fractional"*, then
1. Throw a *RangeError* exception.
1. If _prevStyle_ is *"numeric"* or *"2-digit"*, then
1. If _style_ is not *"numeric"* or *"2-digit"*, then
1. If _style_ is not *"fractional"*, *"numeric"* or *"2-digit"*, then
1. Throw a *RangeError* exception.
1. Else if _unit_ is *"minutes"* or *"seconds"*, then
1. If _unit_ is *"minutes"* or *"seconds"*, then
1. Set _style_ to *"2-digit"*.
1. If _style_ is *"numeric"* and _display_ is *"always"* and _unit_ is one of *"milliseconds"*, *"microseconds"*, or *"nanoseconds"*, then
1. Throw a *RangeError* exception.
1. Return the Record {
[[Style]]: _style_,
[[Display]]: _display_
Expand Down

0 comments on commit 9730552

Please sign in to comment.