1.1.6 GetDurationUnitOptions ( unit, options, baseStyle, stylesList, digitalBase, prevStyle )
- The abstract operation GetDurationUnitOptions takes arguments unit (a String), options (an ECMAScript language value), baseStyle (a String), stylesList (a List of Strings), digitalBase (a String), and prevStyle (a String) and returns either a normal completion containing a Record with [[Style]] and [[Display]] fields, or an abrupt completion. It extracts the relevant options for any given unit from an options bag and returns them as a Record. It performs the following steps when called:
+ The abstract operation GetDurationUnitOptions takes arguments unit (a String), options (an Object), baseStyle (a String), stylesList (a List of Strings), digitalBase (a String), and prevStyle (a String) and returns either a normal completion containing a Record with [[Style]] and [[Display]] fields, or an abrupt completion. It extracts the relevant options for any given unit from an Object and returns them as a Record. It performs the following steps when called:
- Let style be ? GetOption(options, unit, string, stylesList, undefined).
- Let displayDefault be "always".
- If style is undefined, then
- If baseStyle is "digital", then
- If unit is not one of "hours", "minutes", or "seconds", then
- Set displayDefault to "auto".
- Set style to digitalBase.
- Else,
- If prevStyle is "numeric" or "2-digit", then
- If unit is not one of "minutes" or "seconds", then
- Set displayDefault to "auto".
- Set style to "numeric".
- Else,
- Set displayDefault to "auto".
- Set style to baseStyle.
- Else if style is "numeric" and unit is one of "milliseconds", "microseconds", or "nanoseconds", then
- Set displayDefault to "auto".
- Let displayField be the string-concatenation of unit and "Display".
- Let display be ? GetOption(options, displayField, string, « "auto", "always" », displayDefault).
- If prevStyle is "numeric" or "2-digit", then
- If style is not "numeric" or "2-digit", then
- Throw a RangeError exception.
- Else if unit is "minutes" or "seconds", then
- Set style to "2-digit".
- If style is "numeric" and display is "always" and unit is one of "milliseconds", "microseconds", or "nanoseconds", then
- Throw a RangeError exception.
- Return the Record {
[[Style]]: style,
diff --git a/spec.emu b/spec.emu
index bceca9c..00fbde8 100644
--- a/spec.emu
+++ b/spec.emu
@@ -190,7 +190,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud
GetDurationUnitOptions (
_unit_: a String,
- _options_: an ECMAScript language value,
+ _options_: an Object,
_baseStyle_: a String,
_stylesList_: a List of Strings,
_digitalBase_: a String,
@@ -199,7 +199,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud