diff --git a/spec/datetimeformat.html b/spec/datetimeformat.html
index 09285d46..648930e0 100644
--- a/spec/datetimeformat.html
+++ b/spec/datetimeformat.html
@@ -1049,59 +1049,54 @@
PartitionDateTimeRangePattern ( _dateTimeFormat_, _x_, _y_ )
The PartitionDateTimeRangePattern abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat), _x_ (which must be a Number value) and _y_ (which must be a Number value), interprets _x_ and _y_ as time values as specified in es2023, , and creates the corresponding parts according to the effective locale and the formatting options of _dateTimeFormat_. The following steps are taken:
- 1. Let _x_ be TimeClip(_x_).
+ 1. Set _x_ to TimeClip(_x_).
1. If _x_ is *NaN*, throw a *RangeError* exception.
- 1. Let _y_ be TimeClip(_y_).
+ 1. Set _y_ to TimeClip(_y_).
1. If _y_ is *NaN*, throw a *RangeError* exception.
1. Let _tm1_ be ToLocalTime(ℤ(ℝ(_x_) × 106), _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]).
1. Let _tm2_ be ToLocalTime(ℤ(ℝ(_y_) × 106), _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]).
1. Let _rangePatterns_ be _dateTimeFormat_.[[RangePatterns]].
- 1. Let _rangePattern_ be *undefined*.
- 1. Let _dateFieldsPracticallyEqual_ be *true*.
- 1. Let _patternContainsLargerDateField_ be *false*.
- 1. While _dateFieldsPracticallyEqual_ is *true* and _patternContainsLargerDateField_ is *false*, repeat for each row of in order, except the header row:
+ 1. Let _selectedRangePattern_ be *undefined*.
+ 1. Let _relevantFieldsEqual_ be *true*.
+ 1. Let _checkMoreFields_ be *true*.
+ 1. For each row of , except the header row, in table order, do
1. Let _fieldName_ be the name given in the Range Pattern Field column of the row.
- 1. If _rangePatterns_ has a field [[<_fieldName_>]], let _rp_ be _rangePatterns_.[[<_fieldName_>]]; else let _rp_ be *undefined*.
- 1. If _rangePattern_ is not *undefined* and _rp_ is *undefined*, then
- 1. Set _patternContainsLargerDateField_ to *true*.
- 1. Else,
- 1. Let _rangePattern_ be _rp_.
+ 1. If _rangePatterns_ has a field [[<_fieldName_>]], let _rangePattern_ be _rangePatterns_.[[<_fieldName_>]]; else let _rangePattern_ be *undefined*.
+ 1. If _selectedRangePattern_ is not *undefined* and _rangePattern_ is *undefined*, then
+ 1. NOTE: Because there is no range pattern for differences at or below this field, no further checks will be performed.
+ 1. Set _checkMoreFields_ to *false*.
+ 1. If _relevantFieldsEqual_ is *true* and _checkMoreFields_ is *true*, then
+ 1. Set _selectedRangePattern_ to _rangePattern_.
1. If _fieldName_ is equal to [[AmPm]], then
- 1. Let _v1_ be _tm1_.[[Hour]].
- 1. Let _v2_ be _tm2_.[[Hour]].
- 1. If _v1_ is greater than 11 and _v2_ less or equal than 11, or _v1_ is less or equal than 11 and _v2_ is greater than 11, then
- 1. Set _dateFieldsPracticallyEqual_ to *false*.
+ 1. If _tm1_.[[Hour]] is less than 12, let _v1_ be *"am"*; else let _v1_ be *"pm"*.
+ 1. If _tm2_.[[Hour]] is less than 12, let _v2_ be *"am"*; else let _v2_ be *"pm"*.
1. Else if _fieldName_ is equal to [[DayPeriod]], then
1. Let _v1_ be a String value representing the day period of _tm1_; the String value depends upon the implementation and the effective locale of _dateTimeFormat_.
1. Let _v2_ be a String value representing the day period of _tm2_; the String value depends upon the implementation and the effective locale of _dateTimeFormat_.
- 1. If _v1_ is not equal to _v2_, then
- 1. Set _dateFieldsPracticallyEqual_ to *false*.
1. Else if _fieldName_ is equal to [[FractionalSecondDigits]], then
1. Let _fractionalSecondDigits_ be _dateTimeFormat_.[[FractionalSecondDigits]].
1. If _fractionalSecondDigits_ is *undefined*, then
1. Set _fractionalSecondDigits_ to 3.
- 1. Let _v1_ be _tm1_.[[Millisecond]].
- 1. Let _v2_ be _tm2_.[[Millisecond]].
- 1. Let _v1_ be floor(_v1_ × 10( _fractionalSecondDigits_ - 3 )).
- 1. Let _v2_ be floor(_v2_ × 10( _fractionalSecondDigits_ - 3 )).
- 1. If _v1_ is not equal to _v2_, then
- 1. Set _dateFieldsPracticallyEqual_ to *false*.
+ 1. Let _exp_ be _fractionalSecondDigits_ - 3.
+ 1. Let _v1_ be floor(_tm1_.[[Millisecond]] × 10_exp_).
+ 1. Let _v2_ be floor(_tm2_.[[Millisecond]] × 10_exp_).
1. Else,
1. Let _v1_ be _tm1_.[[<_fieldName_>]].
1. Let _v2_ be _tm2_.[[<_fieldName_>]].
- 1. If _v1_ is not equal to _v2_, then
- 1. Set _dateFieldsPracticallyEqual_ to *false*.
- 1. If _dateFieldsPracticallyEqual_ is *true*, then
+ 1. If _v1_ is not equal to _v2_, then
+ 1. Set _relevantFieldsEqual_ to *false*.
+ 1. If _relevantFieldsEqual_ is *true*, then
+ 1. Let _collapsedResult_ be a new empty List.
1. Let _pattern_ be _dateTimeFormat_.[[Pattern]].
1. Let _patternParts_ be PartitionPattern(_pattern_).
- 1. Let _result_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _x_, *undefined*).
- 1. For each Record { [[Type]], [[Value]] } _r_ in _result_, do
- 1. Set _r_.[[Source]] to *"shared"*.
- 1. Return _result_.
- 1. Let _result_ be a new empty List.
- 1. If _rangePattern_ is *undefined*, then
- 1. Let _rangePattern_ be _rangePatterns_.[[Default]].
- 1. For each Record { [[Pattern]], [[Source]] } _rangePatternPart_ in _rangePattern_.[[PatternParts]], do
+ 1. Let _resultParts_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _x_, *undefined*).
+ 1. For each Record { [[Type]], [[Value]] } _r_ in _resultParts_, do
+ 1. Append a new Record { [[Type]]: _r_.[[Type]], [[Value]]: _r_.[[Value]], [[Source]]: *"shared"* } as the last element of _collapsedResult_.
+ 1. Return _collapsedResult_.
+ 1. Let _rangeResult_ be a new empty List.
+ 1. If _selectedRangePattern_ is *undefined*, then
+ 1. Set _selectedRangePattern_ to _rangePatterns_.[[Default]].
+ 1. For each Record { [[Pattern]], [[Source]] } _rangePatternPart_ in _selectedRangePattern_.[[PatternParts]], do
1. Let _pattern_ be _rangePatternPart_.[[Pattern]].
1. Let _source_ be _rangePatternPart_.[[Source]].
1. If _source_ is *"startRange"* or *"shared"*, then
@@ -1109,11 +1104,10 @@ PartitionDateTimeRangePattern ( _dateTimeFormat_, _x_, _y_ )
1. Else,
1. Let _z_ be _y_.
1. Let _patternParts_ be PartitionPattern(_pattern_).
- 1. Let _partResult_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _z_, _rangePattern_).
- 1. For each Record { [[Type]], [[Value]] } _r_ in _partResult_, do
- 1. Set _r_.[[Source]] to _source_.
- 1. Add all elements in _partResult_ to _result_ in order.
- 1. Return _result_.
+ 1. Let _resultParts_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _z_, _selectedRangePattern_).
+ 1. For each Record { [[Type]], [[Value]] } _r_ in _resultParts_, do
+ 1. Append a new Record { [[Type]]: _r_.[[Type]], [[Value]]: _r_.[[Value]], [[Source]]: _source_ } as the last element of _rangeResult_.
+ 1. Return _rangeResult_.