Skip to content

Commit

Permalink
Normative: Fix validation of options, similar to Locale
Browse files Browse the repository at this point in the history
  • Loading branch information
littledan committed Jan 9, 2020
1 parent 436f899 commit b8dde1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion spec/datetimeformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, *"string"*, &laquo; *"lookup"*, *"best fit"* &raquo;, *"best fit"*).
1. Set _opt_.[[localeMatcher]] to _matcher_.
1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, *"string"*, *undefined*, *undefined*).
1. If _calendar_ does not match `type`, throw a *RangeError* exception.
1. If _calendar_ is not *undefined*, then
1. If _calendar_ does not match the `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError* exception.
1. Set _opt_.[[ca]] to _calendar_.
1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, *"string"*, *undefined*, *undefined*).
1. If _numberingSystem_ does not match `type`, throw a *RangeError* exception.
1. If _numberingSystem_ is not *undefined*, then
1. If _numberingSystem_ does not match the `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError* exception.
1. Set _opt_.[[nu]] to _numberingSystem_.
1. Let _hour12_ be ? GetOption(_options_, *"hour12"*, *"boolean"*, *undefined*, *undefined*).
1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, *"string"*, &laquo; *"h11"*, *"h12"*, *"h23"*, *"h24"* &raquo;, *undefined*).
Expand Down
3 changes: 2 additions & 1 deletion spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h1>InitializeNumberFormat ( _numberFormat_, _locales_, _options_ )</h1>
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, *"string"*, &laquo; *"lookup"*, *"best fit"* &raquo;, *"best fit"*).
1. Set _opt_.[[localeMatcher]] to _matcher_.
1. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, `"string"`, *undefined*, *undefined*).
1. If _numberingSystem_ does not match `type`, throw a *RangeError* exception.
1. If _numberingSystem_ is not *undefined*, then
1. If _numberingSystem_ does not match the `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError* exception.
1. Set _opt_.[[nu]] to _numberingSystem_.
1. Let _localeData_ be %NumberFormat%.[[LocaleData]].
1. Let _r_ be ResolveLocale(%NumberFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %NumberFormat%.[[RelevantExtensionKeys]], _localeData_).
Expand Down

0 comments on commit b8dde1f

Please sign in to comment.