LibJS: Require strict matching with a precise ZonedDateTime offset

This is a normative change in the Temporal proposal. See:
1117eaf
This commit is contained in:
Timothy Flynn 2025-06-02 10:13:05 -04:00 committed by Shannon Booth
parent f091047159
commit c8b4dc4847
Notes: github-actions[bot] 2025-06-02 21:10:33 +00:00
3 changed files with 70 additions and 6 deletions

View file

@ -630,6 +630,19 @@ ThrowCompletionOr<RelativeTo> get_temporal_relative_to_option(VM& vm, Object con
// iv. Set matchBehaviour to MATCH-MINUTES.
match_behavior = MatchBehavior::MatchMinutes;
// v. If offsetString is not EMPTY, then
if (offset_string.has_value()) {
// 1. Let offsetParseResult be ParseText(StringToCodePoints(offsetString), UTCOffset[+SubMinutePrecision]).
auto offset_parse_result = parse_utc_offset(*offset_string, SubMinutePrecision::Yes);
// 2. Assert: offsetParseResult is a Parse Node.
VERIFY(offset_parse_result.has_value());
// 3. If offsetParseResult contains more than one MinuteSecond Parse Node, set matchBehaviour to MATCH-EXACTLY.
if (offset_parse_result->seconds.has_value())
match_behavior = MatchBehavior::MatchExactly;
}
}
// g. Let calendar be result.[[Calendar]].