mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 20:32:56 +03:00
LibJS: Subtract time zone offsets when converting from local time to UTC
When converting to UTC, the UTC AO first tries to disambiguate possible time zone offsets for the given local time. When doing so, the GetNamedTimeZoneEpochNanoseconds AO must *subtract* the found time zone offset from the local time to convert to UTC. The same is performed later in the UTC AO when returning the final UTC time (step 5).
This commit is contained in:
parent
2d4591dad4
commit
094f9bf6a2
Notes:
sideshowbarker
2024-07-17 05:43:59 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/094f9bf6a2 Pull-request: https://github.com/SerenityOS/serenity/pull/15627
@ -342,7 +342,7 @@ Vector<Crypto::SignedBigInteger> get_named_time_zone_epoch_nanoseconds(StringVie
|
||||
// Can only fail if the time zone identifier is invalid, which cannot be the case here.
|
||||
VERIFY(offset.has_value());
|
||||
|
||||
return { local_nanoseconds.plus(Crypto::SignedBigInteger { offset->seconds }.multiplied_by(s_one_billion_bigint)) };
|
||||
return { local_nanoseconds.minus(Crypto::SignedBigInteger { offset->seconds }.multiplied_by(s_one_billion_bigint)) };
|
||||
}
|
||||
|
||||
// 21.4.1.9 GetNamedTimeZoneOffsetNanoseconds ( timeZoneIdentifier, epochNanoseconds ), https://tc39.es/ecma262/#sec-getnamedtimezoneoffsetnanoseconds
|
||||
|
Loading…
Reference in New Issue
Block a user