diff options
author | Linus Groh <mail@linusgroh.de> | 2022-02-04 19:18:44 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-04 20:00:34 +0000 |
commit | c48f695b90b70731afa7785d978150e6d2b6fed1 (patch) | |
tree | 14a0cc36ab7f0825f98fd97d9a49d7e887c47aa8 /Userland/Libraries/LibJS/Runtime | |
parent | 28ac5a1333dfad3173b83b0f79f34c8a67624963 (diff) | |
download | serenity-c48f695b90b70731afa7785d978150e6d2b6fed1.zip |
LibJS: Remove '-000000' check from ParseTemporalYearMonthString
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/3be4b5d
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 9c1efab97f..fbb8bcc496 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -1682,24 +1682,16 @@ ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(GlobalObje return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidYearMonthString, iso_string); } - // FIXME: I don't think this check makes sense - the TemporalYearMonthString syntax check above - // should rule out a string that's '-000000'; it requires a month with a non-zero digit - // in it, and the normalized year is checked separately in ParseISODateTime below. - // :yakshrug: - // 3. If ! SameValue(isoString, "-000000") is true, throw a RangeError exception. - if (iso_string == "-000000"sv) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidExtendedYearNegativeZero); - - // 4. If isoString contains a UTCDesignator, then + // 3. If isoString contains a UTCDesignator, then if (parse_result->utc_designator.has_value()) { // a. Throw a RangeError exception. return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidYearMonthStringUTCDesignator, iso_string); } - // 5. Let result be ? ParseISODateTime(isoString). + // 4. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); - // 6. Return the Record { [[Year]]: result.[[Year]], [[Month]]: result.[[Month]], [[Day]]: result.[[Day]], [[Calendar]]: result.[[Calendar]] }. + // 5. Return the Record { [[Year]]: result.[[Year]], [[Month]]: result.[[Month]], [[Day]]: result.[[Day]], [[Calendar]]: result.[[Calendar]] }. return TemporalYearMonth { .year = result.year, .month = result.month, .day = result.day, .calendar = move(result.calendar) }; } |