mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
LibJS: Fix fraction substring in ParseTimeZoneOffsetString
This is a normative change in the Temporal spec. See: - https://github.com/tc39/proposal-temporal/commit/97d553c - https://github.com/tc39/proposal-temporal/commit/d53af7f Note that we already implemented this correctly, so the only change is updating the spec comment.
This commit is contained in:
parent
356fa2dca1
commit
619794dfa7
Notes:
sideshowbarker
2024-07-17 17:16:30 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/619794dfa7 Pull-request: https://github.com/SerenityOS/serenity/pull/13081 Reviewed-by: https://github.com/IdanHo ✅
@ -296,7 +296,10 @@ ThrowCompletionOr<double> parse_time_zone_offset_string(GlobalObject& global_obj
|
||||
if (fraction_part.has_value()) {
|
||||
// a. Set fraction to the string-concatenation of the previous value of fraction and the string "000000000".
|
||||
auto fraction = String::formatted("{}000000000", *fraction_part);
|
||||
// b. Let nanoseconds be the String value equal to the substring of fraction consisting of the code units with indices 0 (inclusive) through 9 (exclusive).
|
||||
|
||||
// b. Let nanoseconds be the String value equal to the substring of fraction from 1 to 10.
|
||||
// NOTE: parse_time_zone_numeric_utc_offset_syntax(), which we use to capture TimeZoneUTCOffsetFraction, doesn't include the decimal separator.
|
||||
|
||||
// c. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds).
|
||||
nanoseconds = *fraction.substring(0, 9).to_int<i32>();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user