Commit f5ef68de authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Fix TimeZone getPossibleInstantsFor

Subtract timeZone.[[OffsetNanoseconds]] from epochNanoseconds
before calling the IsValidEpochNanoseconds() for the case of
4. If timeZone.[[OffsetNanoseconds]] is not undefined

Bug: v8:11544
Change-Id: Icea2d8390a9db01054956f8c57b47dc5a88446d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3855980Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82802}
parent 0f901f00
......@@ -11241,21 +11241,27 @@ MaybeHandle<JSArray> JSTemporalTimeZone::GetPossibleInstantsFor(
// dateTime.[[ISONanosecond]]).
Handle<BigInt> epoch_nanoseconds =
GetEpochFromISOParts(isolate, date_time_record);
// b. Let possibleEpochNanoseconds be « epochNanoseconds -
// ℤ(timeZone.[[OffsetNanoseconds]]) ».
epoch_nanoseconds =
BigInt::Subtract(
isolate, epoch_nanoseconds,
BigInt::FromInt64(isolate, time_zone->offset_nanoseconds()))
.ToHandleChecked();
// The following is the step 7 and 8 for the case of step 4 under the if
// block.
// a. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a
// RangeError exception.
if (!IsValidEpochNanoseconds(isolate, epoch_nanoseconds)) {
THROW_NEW_ERROR(isolate, NEW_TEMPORAL_INVALID_ARG_RANGE_ERROR(), JSArray);
}
// b. Let instant be ! CreateTemporalInstant(epochNanoseconds
// timeZone.[[OffsetNanoseconds]]).
// b. Let instant be ! CreateTemporalInstant(epochNanoseconds).
Handle<JSTemporalInstant> instant =
temporal::CreateTemporalInstant(
isolate,
BigInt::Subtract(
isolate, epoch_nanoseconds,
BigInt::FromInt64(isolate, time_zone->offset_nanoseconds()))
.ToHandleChecked())
temporal::CreateTemporalInstant(isolate, epoch_nanoseconds)
.ToHandleChecked();
// c. Return ! CreateArrayFromList(« instant »).
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
......
......@@ -681,7 +681,6 @@
'built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-with-fractional-days': [FAIL],
'built-ins/Temporal/PlainTime/prototype/add/argument-string-duration-too-large': [FAIL],
'built-ins/Temporal/PlainTime/prototype/subtract/argument-string-duration-too-large': [FAIL],
'built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/fixed-offset-near-date-time-limits': [FAIL],
'intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition': [FAIL],
'intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment