You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// a. Let record be ? NudgeToCalendarUnit(sign, duration, destEpochNs, isoDateTime, timeZone, calendar, increment, smallestUnit, roundingMode).
1344
-
auto record = TRY(nudge_to_calendar_unit(vm, sign, duration, dest_epoch_ns, iso_date_time, time_zone, calendar, increment, smallest_unit, rounding_mode));
1356
+
// a. Let record be ? NudgeToCalendarUnit(sign, duration, originEpochNs, destEpochNs, isoDateTime, timeZone, calendar, increment, smallestUnit, roundingMode).
1357
+
auto record = TRY(nudge_to_calendar_unit(vm, sign, duration, origin_epoch_ns, dest_epoch_ns, iso_date_time, time_zone, calendar, increment, smallest_unit, rounding_mode));
// 1. If IsCalendarUnit(unit) is true, or timeZone is not UNSET and unit is DAY, then
1380
1393
if (is_calendar_unit(unit) || (time_zone.has_value() && unit == Unit::Day)) {
1381
1394
// a. If InternalDurationSign(duration) < 0, let sign be -1; else let sign be 1.
1382
1395
auto sign = internal_duration_sign(duration) < 0 ? -1 : 1;
1383
1396
1384
-
// b. Let record be ? NudgeToCalendarUnit(sign, duration, destEpochNs, isoDateTime, timeZone, calendar, 1, unit, TRUNC).
1385
-
auto record = TRY(nudge_to_calendar_unit(vm, sign, duration, dest_epoch_ns, iso_date_time, time_zone, calendar, 1, unit, RoundingMode::Trunc));
1397
+
// b. Let record be ? NudgeToCalendarUnit(sign, duration, originEpochNs, destEpochNs, isoDateTime, timeZone, calendar, 1, unit, TRUNC).
1398
+
auto record = TRY(nudge_to_calendar_unit(vm, sign, duration, origin_epoch_ns, dest_epoch_ns, iso_date_time, time_zone, calendar, 1, unit, RoundingMode::Trunc));
// f. Set internalDuration to ? DifferenceZonedDateTimeWithRounding(relativeEpochNs, targetEpochNs, timeZone, calendar, largestUnit, roundingIncrement, smallestUnit, roundingMode).
// 5.5.14 DifferencePlainDateTimeWithTotal ( isoDateTime1, isoDateTime2, calendar, unit ), https://tc39.es/proposal-temporal/#sec-temporal-differenceplaindatetimewithtotal
Copy file name to clipboardExpand all lines: Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -254,14 +254,17 @@ ThrowCompletionOr<GC::Ref<Duration>> difference_temporal_plain_year_month(VM& vm
254
254
// a. Let isoDateTime be CombineISODateAndTimeRecord(thisDate, MidnightTimeRecord()).
255
255
auto iso_date_time = combine_iso_date_and_time_record(this_date, midnight_time_record());
256
256
257
-
// b. Let isoDateTimeOther be CombineISODateAndTimeRecord(otherDate, MidnightTimeRecord()).
257
+
// b. Let originEpochNs be GetUTCEpochNanoseconds(isoDateTime).
258
+
auto origin_epoch_ns = get_utc_epoch_nanoseconds(iso_date_time);
259
+
260
+
// c. Let isoDateTimeOther be CombineISODateAndTimeRecord(otherDate, MidnightTimeRecord()).
258
261
auto iso_date_time_other = combine_iso_date_and_time_record(other_date, midnight_time_record());
259
262
260
-
//c. Let destEpochNs be GetUTCEpochNanoseconds(isoDateTimeOther).
263
+
//d. Let destEpochNs be GetUTCEpochNanoseconds(isoDateTimeOther).
261
264
auto dest_epoch_ns = get_utc_epoch_nanoseconds(iso_date_time_other);
262
265
263
-
//d. Set duration to ? RoundRelativeDuration(duration, destEpochNs, isoDateTime, UNSET, calendar, settings.[[LargestUnit]], settings.[[RoundingIncrement]], settings.[[SmallestUnit]], settings.[[RoundingMode]]).
//e. Set duration to ? RoundRelativeDuration(duration, originEpochNs, destEpochNs, isoDateTime, UNSET, calendar, settings.[[LargestUnit]], settings.[[RoundingIncrement]], settings.[[SmallestUnit]], settings.[[RoundingMode]]).
0 commit comments