From eea517b4df8ab009221c55938aec16dbf9d8c60d Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Mon, 15 Jan 2024 05:12:53 -0800 Subject: [PATCH] updated properties of Intl.DurationFormat instances to reflect new internal "fractional" style --- index.html | 8 ++++---- spec.emu | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index ca76675..a80d34f 100644 --- a/index.html +++ b/index.html @@ -2633,7 +2633,7 @@

1.1.5 IsValidDurationRecord ( record

1.1.6 GetDurationUnitOptions ( unit, options, baseStyle, stylesList, digitalBase, prevStyle )

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:

-
  1. Let style be ? GetOption(options, unit, string, stylesList, undefined).
  2. Let displayDefault be "always".
  3. If style is undefined, then
    1. If baseStyle is "digital", then
      1. If unit is not one of "hours", "minutes", or "seconds", then
        1. Set displayDefault to "auto".
      2. Set style to digitalBase.
    2. Else,
      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".
        2. If unit is one of "milliseconds", "microseconds", or "nanoseconds", then
          1. Set style to "fractional".
          2. Set displayDefault to "auto".
        3. Else,
          1. Set style to "numeric".
      2. Else,
        1. Set displayDefault to "auto".
        2. Set style to baseStyle.
  4. If style is "numeric", then
    1. If unit is one of "milliseconds", "microseconds", or "nanoseconds", then
      1. Set style to "fractional".
  5. Let displayField be the string-concatenation of unit and "Display".
  6. Let display be ? GetOption(options, displayField, string, « "auto", "always" », displayDefault).
  7. If display is "always" and style is "fractional", then
    1. Throw a RangeError exception.
  8. If prevStyle is "fractional", then
    1. If style is not "fractional", then
      1. Throw a RangeError exception.
  9. If prevStyle is "numeric" or "2-digit", then
    1. If style is not "fractional", "numeric" or "2-digit", then
      1. Throw a RangeError exception.
    2. If unit is "minutes" or "seconds", then
      1. Set style to "2-digit".
  10. Return the Record { +
    1. Let style be ? GetOption(options, unit, string, stylesList, undefined).
    2. Let displayDefault be "always".
    3. If style is undefined, then
      1. If baseStyle is "digital", then
        1. If unit is not one of "hours", "minutes", or "seconds", then
          1. Set displayDefault to "auto".
        2. Set style to digitalBase.
      2. Else,
        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".
          2. If unit is one of "milliseconds", "microseconds", or "nanoseconds", then
            1. Set style to "fractional".
          3. Else,
            1. Set style to "numeric".
        2. Else,
          1. Set displayDefault to "auto".
          2. Set style to baseStyle.
    4. If style is "numeric", then
      1. If unit is one of "milliseconds", "microseconds", or "nanoseconds", then
        1. Set style to "fractional".
        2. Set displayDefault to "auto".
    5. Let displayField be the string-concatenation of unit and "Display".
    6. Let display be ? GetOption(options, displayField, string, « "auto", "always" », displayDefault).
    7. If display is "always" and style is "fractional", then
      1. Throw a RangeError exception.
    8. If prevStyle is "fractional", then
      1. If style is not "fractional", then
        1. Throw a RangeError exception.
    9. If prevStyle is "numeric" or "2-digit", then
      1. If style is not "fractional", "numeric" or "2-digit", then
        1. Throw a RangeError exception.
      2. If unit is "minutes" or "seconds", then
        1. Set style to "2-digit".
    10. Return the Record { [[Style]]: style, [[Display]]: display }.
    @@ -3051,11 +3051,11 @@

    1.5 Properties of Intl.DurationFormat Instances<
  11. [[MinutesDisplay]] is one of the String values "auto" or "always" identifying when to display the minutes field.
  12. [[SecondsStyle]] is one of the String values "long", "short", "narrow", "2-digit", or "numeric" identifying the formatting style used for the seconds field.
  13. [[SecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the seconds field.
  14. -
  15. [[MillisecondsStyle]] is one of the String values "long", "short", "narrow", or "numeric" identifying the formatting style used for the milliseconds field.
  16. +
  17. [[MillisecondsStyle]] is one of the String values "long", "short", "narrow", or "fractional" identifying the formatting style used for the milliseconds field.
  18. [[MillisecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the milliseconds field.
  19. -
  20. [[MicrosecondsStyle]] is one of the String values "long", "short", "narrow", or "numeric" identifying the formatting style used for the microseconds field.
  21. +
  22. [[MicrosecondsStyle]] is one of the String values "long", "short", "narrow", or "fractional" identifying the formatting style used for the microseconds field.
  23. [[MicrosecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the microseconds field.
  24. -
  25. [[NanosecondsStyle]] is one of the String values "long", "short", "narrow", or "numeric" identifying the formatting style used for the nanoseconds field.
  26. +
  27. [[NanosecondsStyle]] is one of the String values "long", "short", "narrow", or "fractional" identifying the formatting style used for the nanoseconds field.
  28. [[NanosecondsDisplay]] is one of the String values "auto" or "always" identifying when to display the nanoseconds field.
  29. [[FractionalDigits]] is a non-negative integer, identifying the number of fractional digits to be used with numeric styles, or is undefined.
  30. diff --git a/spec.emu b/spec.emu index 59885c2..776ba9f 100644 --- a/spec.emu +++ b/spec.emu @@ -216,7 +216,6 @@ contributors: Ujjwal Sharma, Younies Mahmoud 1. Set _displayDefault_ to *"auto"*. 1. If _unit_ is one of *"milliseconds"*, *"microseconds"*, or *"nanoseconds"*, then 1. Set _style_ to *"fractional"*. - 1. Set _displayDefault_ to *"auto"*. 1. Else, 1. Set _style_ to *"numeric"*. 1. Else, @@ -225,6 +224,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud 1. If _style_ is *"numeric"*, then 1. If _unit_ is one of *"milliseconds"*, *"microseconds"*, or *"nanoseconds"*, then 1. Set _style_ to *"fractional"*. + 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 @@ -865,11 +865,11 @@ contributors: Ujjwal Sharma, Younies Mahmoud
  31. [[MinutesDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the minutes field.
  32. [[SecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, *"2-digit"*, or *"numeric"* identifying the formatting style used for the seconds field.
  33. [[SecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the seconds field.
  34. -
  35. [[MillisecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"numeric"* identifying the formatting style used for the milliseconds field.
  36. +
  37. [[MillisecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"fractional"* identifying the formatting style used for the milliseconds field.
  38. [[MillisecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the milliseconds field.
  39. -
  40. [[MicrosecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"numeric"* identifying the formatting style used for the microseconds field.
  41. +
  42. [[MicrosecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"fractional"* identifying the formatting style used for the microseconds field.
  43. [[MicrosecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the microseconds field.
  44. -
  45. [[NanosecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"numeric"* identifying the formatting style used for the nanoseconds field.
  46. +
  47. [[NanosecondsStyle]] is one of the String values *"long"*, *"short"*, *"narrow"*, or *"fractional"* identifying the formatting style used for the nanoseconds field.
  48. [[NanosecondsDisplay]] is one of the String values *"auto"* or *"always"* identifying when to display the nanoseconds field.
  49. [[FractionalDigits]] is a non-negative integer, identifying the number of fractional digits to be used with numeric styles, or is *undefined*.