diff --git a/index.html b/index.html index 1a1ad6f..dc84ff8 100644 --- a/index.html +++ b/index.html @@ -3446,7 +3446,7 @@

1.1.10 FormatNumericMinutes ( durationForma

1.1.11 FormatNumericSeconds ( durationFormat, secondsValue, minutesDisplayed, signDisplayed )

The abstract operation FormatNumericSeconds takes arguments durationFormat (a DurationFormat Object), secondsValue (a mathematical value), minutesDisplayed (a Boolean), and signDisplayed (a Boolean) and returns a List of Records. secondsValue is a mathematical value indicating a number of seconds. It creates the parts for secondsValue according to the effective locale and the formatting options of durationFormat. It performs the following steps when called:

-
  1. Let result be a new empty List.
  2. If minutesDisplayed is true, then
    1. Let separator be durationFormat.[[MinuteSecondSeparator]].
    2. Append the Record { [[Type]]: "literal", [[Value]]: separator, [[Unit]]: empty } to result.
  3. Let secondsStyle be durationFormat.[[SecondsStyle]].
  4. Assert: secondsStyle is "numeric" or secondsStyle is "2-digit".
  5. Let nfOpts be OrdinaryObjectCreate(null).
  6. Let numberingSystem be durationFormat.[[NumberingSystem]].
  7. Perform ! CreateDataPropertyOrThrow(nfOpts, "numberingSystem", numberingSystem).
  8. If secondsStyle is "2-digit", then
    1. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumIntegerDigits", 2𝔽).
  9. If signDisplayed is false, then
    1. Perform ! CreateDataPropertyOrThrow(nfOpts, "signDisplay", "never").
  10. Perform ! CreateDataPropertyOrThrow(nfOpts, "useGrouping", false).
  11. If durationFormat.[[FractionalDigits]] is undefined, then
    1. Let maximumFractionDigits be 9𝔽.
    2. Let minimumFractionDigits be +0𝔽.
  12. Else,
    1. Let maximumFractionDigits be durationFormat.[[FractionalDigits]].
    2. Let minimumFractionDigits be durationFormat.[[FractionalDigits]].
  13. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", maximumFractionDigits).
  14. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", minimumFractionDigits).
  15. Perform ! CreateDataPropertyOrThrow(nfOpts, "roundingMode", "trunc").
  16. Let nf be ! Construct(%NumberFormat%, « durationFormat.[[Locale]], nfOpts »).
  17. Let secondsParts be PartitionNumberPattern(nf, secondsValue).
  18. For each Record { [[Type]], [[Value]] } part of secondsParts, do
    1. Append the Record { [[Type]]: part.[[Type]], [[Value]]: part.[[Value]], [[Unit]]: "second" } to result.
  19. Return result.
+
  1. Let result be a new empty List.
  2. If minutesDisplayed is true, then
    1. Let separator be durationFormat.[[MinuteSecondSeparator]].
    2. Append the Record { [[Type]]: "literal", [[Value]]: separator, [[Unit]]: empty } to result.
  3. Let secondsStyle be durationFormat.[[SecondsStyle]].
  4. Assert: secondsStyle is "numeric" or secondsStyle is "2-digit".
  5. Let nfOpts be OrdinaryObjectCreate(null).
  6. Let numberingSystem be durationFormat.[[NumberingSystem]].
  7. Perform ! CreateDataPropertyOrThrow(nfOpts, "numberingSystem", numberingSystem).
  8. If secondsStyle is "2-digit", then
    1. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumIntegerDigits", 2𝔽).
  9. If signDisplayed is false, then
    1. Perform ! CreateDataPropertyOrThrow(nfOpts, "signDisplay", "never").
  10. Perform ! CreateDataPropertyOrThrow(nfOpts, "useGrouping", false).
  11. If durationFormat.[[FractionalDigits]] is undefined, then
    1. Let maximumFractionDigits be 9𝔽.
    2. Let minimumFractionDigits be +0𝔽.
  12. Else,
    1. Let maximumFractionDigits be durationFormat.[[FractionalDigits]].
    2. Let minimumFractionDigits be durationFormat.[[FractionalDigits]].
  13. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", maximumFractionDigits).
  14. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", minimumFractionDigits).
  15. Perform ! CreateDataPropertyOrThrow(nfOpts, "roundingMode", "trunc").
  16. Let nf be ! Construct(%Intl.NumberFormat%, « durationFormat.[[Locale]], nfOpts »).
  17. Let secondsParts be PartitionNumberPattern(nf, secondsValue).
  18. For each Record { [[Type]], [[Value]] } part of secondsParts, do
    1. Append the Record { [[Type]]: part.[[Type]], [[Value]]: part.[[Value]], [[Unit]]: "second" } to result.
  19. Return result.
diff --git a/spec.emu b/spec.emu index f440c29..8790388 100644 --- a/spec.emu +++ b/spec.emu @@ -418,7 +418,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"maximumFractionDigits"*, _maximumFractionDigits_). 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"minimumFractionDigits"*, _minimumFractionDigits_). 1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"roundingMode"*, *"trunc"*). - 1. Let _nf_ be ! Construct(%NumberFormat%, « _durationFormat_.[[Locale]], _nfOpts_ »). + 1. Let _nf_ be ! Construct(%Intl.NumberFormat%, « _durationFormat_.[[Locale]], _nfOpts_ »). 1. Let _secondsParts_ be PartitionNumberPattern(_nf_, _secondsValue_). 1. For each Record { [[Type]], [[Value]] } _part_ of _secondsParts_, do 1. Append the Record { [[Type]]: _part_.[[Type]], [[Value]]: _part_.[[Value]], [[Unit]]: *"second"* } to _result_.