diff --git a/index.html b/index.html
index f523ac1..0faa050 100644
--- a/index.html
+++ b/index.html
@@ -2643,7 +2643,7 @@
1.1.6 GetDurationUnitOptions ( unit ,
1.1.7 PartitionDurationFormatPattern ( durationFormat , duration )
The abstract operation PartitionDurationFormatPattern takes arguments durationFormat (a DurationFormat) and duration (a Duration Record ) and returns a List . It creates and returns a List with all the corresponding parts according to the effective locale and the formatting options of durationFormat . It performs the following steps when called:
- Let result be a new empty List . Let done be false . Let separated be false . While done is false , repeat for each row in Table 2 in table order, except the header row:Let valueSlot be the Value Slot value. Let styleSlot be the Style Slot value. Let displaySlot be the Display Slot value. Let unit be the Unit value. Let numberFormatUnit be the NumberFormat Unit value. Let style be durationFormat .[[<styleSlot >]]. Let display be durationFormat .[[<displaySlot >]]. Let value be duration .[[<valueSlot >]]. Let nfOpts be OrdinaryObjectCreate (null ). If unit is "seconds" , "milliseconds" , or "microseconds" , thenIf unit is "seconds" , thenLet nextStyle be durationFormat .[[MillisecondsStyle]]. Else if unit is "milliseconds" , thenLet nextStyle be durationFormat .[[MicrosecondsStyle]]. Else,Let nextStyle be durationFormat .[[NanosecondsStyle]]. If nextStyle is "numeric" , thenIf unit is "seconds" , thenSet value to value + duration .[[Milliseconds]] / 103 + duration .[[Microseconds]] / 106 + duration .[[Nanoseconds]] / 109 . Else if unit is "milliseconds" , thenSet value to value + duration .[[Microseconds]] / 103 + duration .[[Nanoseconds]] / 106 . Else,Set value to value + duration .[[Nanoseconds]] / 103 . Perform ! CreateDataPropertyOrThrow (nfOpts , "maximumFractionDigits" , durationFormat .[[FractionalDigits]]). Perform ! CreateDataPropertyOrThrow (nfOpts , "minimumFractionDigits" , durationFormat .[[FractionalDigits]]). Perform ! CreateDataPropertyOrThrow (nfOpts , "roundingMode" , "trunc" ). Set done to true . If style is "2-digit" , thenPerform ! CreateDataPropertyOrThrow (nfOpts , "minimumIntegerDigits" , 2 𝔽 ). If value is not 0 or display is not "auto" , thenPerform ! CreateDataPropertyOrThrow (nfOpts , "numberingSystem" , durationFormat .[[NumberingSystem]]). If style is "2-digit" or "numeric" , thenLet nf be ! Construct (%NumberFormat%, « durationFormat .[[Locale]], nfOpts »). Let dataLocale be durationFormat .[[DataLocale]]. Let dataLocaleData be %DurationFormat% .[[LocaleData]].[[<dataLocale >]]. If separated is false , thenAppend a new empty List to the end of result . Else,Set separated to false . Let last be the last element of result . Let parts be ! PartitionNumberPattern (nf , 𝔽 (value )). For each Record { [[Type]], [[Value]] } part of parts , doAppend the new Record { [[Type]]: part .[[Type]], [[Value]]: part .[[Value]], [[Unit]]: numberFormatUnit } to the end of last . If unit is "hours" or "minutes" , thenIf unit is "hours" , thenLet nextValue be duration .[[Minutes]]. Let nextDisplay be durationFormat .[[MinutesDisplay]]. Else,Let nextValue be duration .[[Seconds]] + duration .[[Milliseconds]] / 103 + duration .[[Microseconds]] / 106 + duration .[[Nanoseconds]] / 109 . Let nextDisplay be durationFormat .[[SecondsDisplay]]. If nextValue is not 0 or nextDisplay is not "auto" , thenLet numberingSystem be durationFormat .[[NumberingSystem]]. Let separator be dataLocaleData .[[digitalFormat]].[[<numberingSystem >]]. Append the new Record { [[Type]]: "literal" , [[Value]]: separator } to the end of last . Set separated to true . Else,Perform ! CreateDataPropertyOrThrow (nfOpts , "style" , "unit" ). Perform ! CreateDataPropertyOrThrow (nfOpts , "unit" , numberFormatUnit ). Perform ! CreateDataPropertyOrThrow (nfOpts , "unitDisplay" , style ). Let nf be ! Construct (%NumberFormat%, « durationFormat .[[Locale]], nfOpts »). Let list be a new empty List . Let parts be ! PartitionNumberPattern (nf , 𝔽 (value )). For each Record { [[Type]], [[Value]] } part in parts , doAppend the new Record { [[Type]]: part .[[Type]], [[Value]]: part .[[Value]], [[Unit]]: numberFormatUnit } to the end of list . Append list to the end of result . Let lfOpts be OrdinaryObjectCreate (null ). Perform ! CreateDataPropertyOrThrow (lfOpts , "type" , "unit" ). Let listStyle be durationFormat .[[Style]]. If listStyle is "digital" , thenSet listStyle to "short" . Perform ! CreateDataPropertyOrThrow (lfOpts , "style" , listStyle ). Let lf be ! Construct (%ListFormat%, « durationFormat .[[Locale]], lfOpts »). Set result to ! CreatePartsFromList (lf , result ). Let flattened be a new empty List . For each Record { [[Type]], [[Value]] } part in result , doIf part .[[Type]] is "literal" , thenAppend part to the end of flattened . Else,Let value be part .[[Value]]. If Type (value ) is Record { [[Type]], [[Value]], [[Unit]] }, thenAppend value to the end of flattened . Else,Assert : Type (value ) is List .For each Record element in value , doAppend element to the end of flattened . Return flattened .
+ Let result be a new empty List . Let done be false . Let separated be false . While done is false , repeat for each row in Table 2 in table order, except the header row:Let valueSlot be the Value Slot value. Let styleSlot be the Style Slot value. Let displaySlot be the Display Slot value. Let unit be the Unit value. Let numberFormatUnit be the NumberFormat Unit value. Let style be durationFormat .[[<styleSlot >]]. Let display be durationFormat .[[<displaySlot >]]. Let value be duration .[[<valueSlot >]]. Let nfOpts be OrdinaryObjectCreate (null ). If unit is "seconds" , "milliseconds" , or "microseconds" , thenIf unit is "seconds" , thenLet nextStyle be durationFormat .[[MillisecondsStyle]]. Else if unit is "milliseconds" , thenLet nextStyle be durationFormat .[[MicrosecondsStyle]]. Else,Let nextStyle be durationFormat .[[NanosecondsStyle]]. If nextStyle is "numeric" , thenIf unit is "seconds" , thenSet value to value + duration .[[Milliseconds]] / 103 + duration .[[Microseconds]] / 106 + duration .[[Nanoseconds]] / 109 . Else if unit is "milliseconds" , thenSet value to value + duration .[[Microseconds]] / 103 + duration .[[Nanoseconds]] / 106 . Else,Set value to value + duration .[[Nanoseconds]] / 103 . If durationFormat .[[FractionalDigits]] is undefined , thenPerform ! CreateDataPropertyOrThrow (nfOpts , "maximumFractionDigits" , 9). Perform ! CreateDataPropertyOrThrow (nfOpts , "minimumFractionDigits" , 0). Else,Perform ! CreateDataPropertyOrThrow (nfOpts , "maximumFractionDigits" , durationFormat .[[FractionalDigits]]). Perform ! CreateDataPropertyOrThrow (nfOpts , "minimumFractionDigits" , durationFormat .[[FractionalDigits]]). Perform ! CreateDataPropertyOrThrow (nfOpts , "roundingMode" , "trunc" ). Set done to true . If style is "2-digit" , thenPerform ! CreateDataPropertyOrThrow (nfOpts , "minimumIntegerDigits" , 2 𝔽 ). If value is not 0 or display is not "auto" , thenPerform ! CreateDataPropertyOrThrow (nfOpts , "numberingSystem" , durationFormat .[[NumberingSystem]]). If style is "2-digit" or "numeric" , thenLet nf be ! Construct (%NumberFormat%, « durationFormat .[[Locale]], nfOpts »). Let dataLocale be durationFormat .[[DataLocale]]. Let dataLocaleData be %DurationFormat% .[[LocaleData]].[[<dataLocale >]]. If separated is false , thenAppend a new empty List to the end of result . Else,Set separated to false . Let last be the last element of result . Let parts be ! PartitionNumberPattern (nf , 𝔽 (value )). For each Record { [[Type]], [[Value]] } part of parts , doAppend the new Record { [[Type]]: part .[[Type]], [[Value]]: part .[[Value]], [[Unit]]: numberFormatUnit } to the end of last . If unit is "hours" or "minutes" , thenIf unit is "hours" , thenLet nextValue be duration .[[Minutes]]. Let nextDisplay be durationFormat .[[MinutesDisplay]]. Else,Let nextValue be duration .[[Seconds]] + duration .[[Milliseconds]] / 103 + duration .[[Microseconds]] / 106 + duration .[[Nanoseconds]] / 109 . Let nextDisplay be durationFormat .[[SecondsDisplay]]. If nextValue is not 0 or nextDisplay is not "auto" , thenLet numberingSystem be durationFormat .[[NumberingSystem]]. Let separator be dataLocaleData .[[digitalFormat]].[[<numberingSystem >]]. Append the new Record { [[Type]]: "literal" , [[Value]]: separator } to the end of last . Set separated to true . Else,Perform ! CreateDataPropertyOrThrow (nfOpts , "style" , "unit" ). Perform ! CreateDataPropertyOrThrow (nfOpts , "unit" , numberFormatUnit ). Perform ! CreateDataPropertyOrThrow (nfOpts , "unitDisplay" , style ). Let nf be ! Construct (%NumberFormat%, « durationFormat .[[Locale]], nfOpts »). Let list be a new empty List . Let parts be ! PartitionNumberPattern (nf , 𝔽 (value )). For each Record { [[Type]], [[Value]] } part in parts , doAppend the new Record { [[Type]]: part .[[Type]], [[Value]]: part .[[Value]], [[Unit]]: numberFormatUnit } to the end of list . Append list to the end of result . Let lfOpts be OrdinaryObjectCreate (null ). Perform ! CreateDataPropertyOrThrow (lfOpts , "type" , "unit" ). Let listStyle be durationFormat .[[Style]]. If listStyle is "digital" , thenSet listStyle to "short" . Perform ! CreateDataPropertyOrThrow (lfOpts , "style" , listStyle ). Let lf be ! Construct (%ListFormat%, « durationFormat .[[Locale]], lfOpts »). Set result to ! CreatePartsFromList (lf , result ). Let flattened be a new empty List . For each Record { [[Type]], [[Value]] } part in result , doIf part .[[Type]] is "literal" , thenAppend part to the end of flattened . Else,Let value be part .[[Value]]. If Type (value ) is Record { [[Type]], [[Value]], [[Unit]] }, thenAppend value to the end of flattened . Else,Assert : Type (value ) is List .For each Record element in value , doAppend element to the end of flattened . Return flattened .
Table 2: DurationFormat instance internal slots and properties relevant to PartitionDurationFormatPattern
@@ -2752,7 +2752,7 @@ 1.2.1 Intl.DurationFormat ( [ locales
When the Intl.DurationFormat function is called with optional arguments locales and options , the following steps are taken:
- If NewTarget is undefined , throw a TypeError exception. Let durationFormat be ? OrdinaryCreateFromConstructor (NewTarget, "%DurationFormatPrototype%" , « [[InitializedDurationFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[YearsStyle]], [[YearsDisplay]], [[MonthsStyle]], [[MonthsDisplay]] , [[WeeksStyle]], [[WeeksDisplay]] , [[DaysStyle]], [[DaysDisplay]] , [[HoursStyle]], [[HoursDisplay]] , [[MinutesStyle]], [[MinutesDisplay]] , [[SecondsStyle]], [[SecondsDisplay]] , [[MillisecondsStyle]], [[MillisecondsDisplay]] , [[MicrosecondsStyle]], [[MicrosecondsDisplay]] , [[NanosecondsStyle]], [[NanosecondsDisplay]], [[FractionalDigits]] »). Let requestedLocales be ? CanonicalizeLocaleList (locales ). Let options be ? GetOptionsObject (options ). Let matcher be ? GetOption (options , "localeMatcher" , string , « "lookup" , "best fit" », "best fit" ). Let numberingSystem be ? GetOption (options , "numberingSystem" , string , undefined , undefined ). If numberingSystem is not undefined , thenIf numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. Let opt be the Record { [[localeMatcher]]: matcher , [[nu]]: numberingSystem }. Let r be ResolveLocale (%DurationFormat% .[[AvailableLocales]], requestedLocales , opt , %DurationFormat% .[[RelevantExtensionKeys]], %DurationFormat% .[[LocaleData]]). Let locale be r.[[locale]]. Set durationFormat .[[Locale]] to locale . Set durationFormat .[[NumberingSystem]] to r .[[nu]]. Let style be ? GetOption (options , "style" , string , « "long" , "short" , "narrow" , "digital" », "short" ). Set durationFormat .[[Style]] to style . Set durationFormat .[[DataLocale]] to r .[[dataLocale]]. Let prevStyle be the empty String. For each row of Table 3 , except the header row, in table order, doLet styleSlot be the Style Slot value of the current row. Let displaySlot be the Display Slot value of the current row. Let unit be the Unit value. Let valueList be the Values value. Let digitalBase be the Digital Default value. Let unitOptions be ? GetDurationUnitOptions (unit , options , style , valueList , digitalBase , prevStyle ). Set the value of the styleSlot slot of durationFormat to unitOptions .[[Style]]. Set the value of the displaySlot slot of durationFormat to unitOptions .[[Display]]. If unit is one of "hours" , "minutes" , "seconds" , "milliseconds" , or "microseconds" , thenSet prevStyle to unitOptions .[[Style]]. Set durationFormat .[[FractionalDigits]] to ? GetNumberOption (options , "fractionalDigits" , 0, 9, 0). Return durationFormat .
+ If NewTarget is undefined , throw a TypeError exception. Let durationFormat be ? OrdinaryCreateFromConstructor (NewTarget, "%DurationFormatPrototype%" , « [[InitializedDurationFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[YearsStyle]], [[YearsDisplay]], [[MonthsStyle]], [[MonthsDisplay]] , [[WeeksStyle]], [[WeeksDisplay]] , [[DaysStyle]], [[DaysDisplay]] , [[HoursStyle]], [[HoursDisplay]] , [[MinutesStyle]], [[MinutesDisplay]] , [[SecondsStyle]], [[SecondsDisplay]] , [[MillisecondsStyle]], [[MillisecondsDisplay]] , [[MicrosecondsStyle]], [[MicrosecondsDisplay]] , [[NanosecondsStyle]], [[NanosecondsDisplay]], [[FractionalDigits]] »). Let requestedLocales be ? CanonicalizeLocaleList (locales ). Let options be ? GetOptionsObject (options ). Let matcher be ? GetOption (options , "localeMatcher" , string , « "lookup" , "best fit" », "best fit" ). Let numberingSystem be ? GetOption (options , "numberingSystem" , string , undefined , undefined ). If numberingSystem is not undefined , thenIf numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. Let opt be the Record { [[localeMatcher]]: matcher , [[nu]]: numberingSystem }. Let r be ResolveLocale (%DurationFormat% .[[AvailableLocales]], requestedLocales , opt , %DurationFormat% .[[RelevantExtensionKeys]], %DurationFormat% .[[LocaleData]]). Let locale be r.[[locale]]. Set durationFormat .[[Locale]] to locale . Set durationFormat .[[NumberingSystem]] to r .[[nu]]. Let style be ? GetOption (options , "style" , string , « "long" , "short" , "narrow" , "digital" », "short" ). Set durationFormat .[[Style]] to style . Set durationFormat .[[DataLocale]] to r .[[dataLocale]]. Let prevStyle be the empty String. For each row of Table 3 , except the header row, in table order, doLet styleSlot be the Style Slot value of the current row. Let displaySlot be the Display Slot value of the current row. Let unit be the Unit value. Let valueList be the Values value. Let digitalBase be the Digital Default value. Let unitOptions be ? GetDurationUnitOptions (unit , options , style , valueList , digitalBase , prevStyle ). Set the value of the styleSlot slot of durationFormat to unitOptions .[[Style]]. Set the value of the displaySlot slot of durationFormat to unitOptions .[[Display]]. If unit is one of "hours" , "minutes" , "seconds" , "milliseconds" , or "microseconds" , thenSet prevStyle to unitOptions .[[Style]]. Set durationFormat .[[FractionalDigits]] to ? GetNumberOption (options , "fractionalDigits" , 0, 9, undefined ). Return durationFormat .
Table 3: Internal slots and property names of DurationFormat instances relevant to Intl.DurationFormat constructor
@@ -2916,7 +2916,7 @@ 1.4.5 Intl.DurationFormat.prototype.resolvedOpti
This function provides access to the locale and options computed during initialization of the object.
- Let df be the this value. Perform ? RequireInternalSlot (df , [[InitializedDurationFormat]]). Let options be OrdinaryObjectCreate (%ObjectPrototype%). For each row of Table 4 , except the header row, in table order, doLet p be the Property value of the current row. Let v be the value of df 's internal slot whose name is the Internal Slot value of the current row. Assert : v is not undefined .Perform ! CreateDataPropertyOrThrow (options , p , v ). Return options .
+ Let df be the this value. Perform ? RequireInternalSlot (df , [[InitializedDurationFormat]]). Let options be OrdinaryObjectCreate (%ObjectPrototype%). For each row of Table 4 , except the header row, in table order, doLet p be the Property value of the current row. Let v be the value of df 's internal slot whose name is the Internal Slot value of the current row. If p is not "fractionalDigits" , thenAssert : v is not undefined . Perform ! CreateDataPropertyOrThrow (options , p , v ). Return options .
Table 4: Resolved Options of DurationFormat Instances
@@ -2928,6 +2928,10 @@ 1.4.5 Intl.DurationFormat.prototype.resolvedOpti
+ [[NumberingSystem]]
+ "numberingSystem"
+
+
[[Locale]]
"locale"
@@ -3019,11 +3023,7 @@ 1.4.5 Intl.DurationFormat.prototype.resolvedOpti
[[FractionalDigits]]
"fractionalDigits"
-
- [[NumberingSystem]]
- "numberingSystem"
-
-
+
@@ -3060,7 +3060,7 @@ 1.5 Properties of Intl.DurationFormat Instances<
[[MicrosecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the microseconds field.
[[NanosecondsStyle]] is one of the String values "long" , "short" , "narrow" , or "numeric" identifying the formatting style used for the nanoseconds field.
[[NanosecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the nanoseconds field.
- [[FractionalDigits]] is a Number value, identifying the number of fractional digits to be used with numeric styles.
+ [[FractionalDigits]] is a Number value, identifying the number of fractional digits to be used with numeric styles, or is undefined .
diff --git a/spec.emu b/spec.emu
index fa3a8ea..7fbaee3 100644
--- a/spec.emu
+++ b/spec.emu
@@ -275,8 +275,12 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. Set _value_ to _value_ + _duration_.[[Microseconds]] / 103 + _duration_.[[Nanoseconds]] / 106 .
1. Else,
1. Set _value_ to _value_ + _duration_.[[Nanoseconds]] / 103 .
- 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"maximumFractionDigits"*, _durationFormat_.[[FractionalDigits]]).
- 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"minimumFractionDigits"*, _durationFormat_.[[FractionalDigits]]).
+ 1. If _durationFormat_.[[FractionalDigits]] is *undefined*, then
+ 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"maximumFractionDigits"*, 9).
+ 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"minimumFractionDigits"*, 0).
+ 1. Else,
+ 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"maximumFractionDigits"*, _durationFormat_.[[FractionalDigits]]).
+ 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"minimumFractionDigits"*, _durationFormat_.[[FractionalDigits]]).
1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"roundingMode"*, *"trunc"*).
1. Set _done_ to *true*.
1. If _style_ is *"2-digit"*, then
@@ -476,7 +480,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. Set the value of the _displaySlot_ slot of _durationFormat_ to _unitOptions_.[[Display]].
1. If _unit_ is one of *"hours"*, *"minutes"*, *"seconds"*, *"milliseconds"*, or *"microseconds"*, then
1. Set _prevStyle_ to _unitOptions_.[[Style]].
- 1. Set _durationFormat_.[[FractionalDigits]] to ? GetNumberOption(_options_, *"fractionalDigits"*, 0, 9, 0).
+ 1. Set _durationFormat_.[[FractionalDigits]] to ? GetNumberOption(_options_, *"fractionalDigits"*, 0, 9, *undefined*).
1. Return _durationFormat_.
@@ -677,7 +681,8 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. For each row of , except the header row, in table order, do
1. Let _p_ be the Property value of the current row.
1. Let _v_ be the value of _df_'s internal slot whose name is the Internal Slot value of the current row.
- 1. Assert: _v_ is not *undefined*.
+ 1. If _p_ is not *"fractionalDigits"*, then
+ 1. Assert: _v_ is not *undefined*.
1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_).
1. Return _options_.
@@ -691,6 +696,10 @@ contributors: Ujjwal Sharma, Younies Mahmoud
Property
+
+ [[NumberingSystem]]
+ *"numberingSystem"*
+
[[Locale]]
*"locale"*
@@ -783,11 +792,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud
[[FractionalDigits]]
*"fractionalDigits"*
-
- [[NumberingSystem]]
- *"numberingSystem"*
-
-
+
@@ -824,7 +829,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud
[[MicrosecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the microseconds field.
[[NanosecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"numeric"* identifying the formatting style used for the nanoseconds field.
[[NanosecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the nanoseconds field.
- [[FractionalDigits]] is a Number value, identifying the number of fractional digits to be used with numeric styles.
+ [[FractionalDigits]] is a Number value, identifying the number of fractional digits to be used with numeric styles, or is *undefined*.