Skip to content

Commit

Permalink
Normative: Fix bug in PlainDateTime since/until with month boundaries
Browse files Browse the repository at this point in the history
Spec text changes corresponding to previous commit, fixing bug where
PlainDateTime since/until would maintain date/time-diff sign compatibility
by backing-off from wrong end and erroneously falling across month
boundaries.
  • Loading branch information
ptomato committed May 15, 2024
1 parent c0a6333 commit 25d5e3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -1338,12 +1338,12 @@ <h1>
1. Let _timeDuration_ be DifferenceTime(_h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_).
1. Let _timeSign_ be NormalizedTimeDurationSign(_timeDuration_).
1. Let _dateSign_ be CompareISODate(_y2_, _mon2_, _d2_, _y1_, _mon1_, _d1_).
1. Let _adjustedDate_ be CreateISODateRecord(_y1_, _mon1_, _d1_).
1. Let _adjustedDate_ be CreateISODateRecord(_y2_, _mon2_, _d2_).
1. If _timeSign_ = -_dateSign_, then
1. Set _adjustedDate_ to BalanceISODate(_adjustedDate_.[[Year]], _adjustedDate_.[[Month]], _adjustedDate_.[[Day]] - _timeSign_).
1. Set _adjustedDate_ to BalanceISODate(_adjustedDate_.[[Year]], _adjustedDate_.[[Month]], _adjustedDate_.[[Day]] + _timeSign_).
1. Set _timeDuration_ to ? Add24HourDaysToNormalizedTimeDuration(_timeDuration_, -_timeSign_).
1. Let _date1_ be ! CreateTemporalDate(_adjustedDate_.[[Year]], _adjustedDate_.[[Month]], _adjustedDate_.[[Day]], _calendarRec_.[[Receiver]]).
1. Let _date2_ be ! CreateTemporalDate(_y2_, _mon2_, _d2_, _calendarRec_.[[Receiver]]).
1. Let _date1_ be ! CreateTemporalDate(_y1_, _mon1_, _d1_, _calendarRec_.[[Receiver]]).
1. Let _date2_ be ! CreateTemporalDate(_adjustedDate_.[[Year]], _adjustedDate_.[[Month]], _adjustedDate_.[[Day]], _calendarRec_.[[Receiver]]).
1. Let _dateLargestUnit_ be LargerOfTwoTemporalUnits(*"day"*, _largestUnit_).
1. Let _untilOptions_ be ! SnapshotOwnProperties(_options_, *null*).
1. Perform ! CreateDataPropertyOrThrow(_untilOptions_, *"largestUnit"*, _dateLargestUnit_).
Expand Down

0 comments on commit 25d5e3e

Please sign in to comment.