mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 11:21:34 +00:00
LibJS+LibUnicode: Support ambiguous time zone transitions
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macOS, macos-15, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macOS, macOS-arm64, macos-15) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, Linux, Linux-x86_64, blacksmith-8vcpu-ubuntu-2404) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macOS, macos-15, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macOS, macOS-arm64, macos-15) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, Linux, Linux-x86_64, blacksmith-8vcpu-ubuntu-2404) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
For example, time zone transitions can result in repeated or skipped wall times. Temporal wants us to handle these transitions.
This commit is contained in:
parent
c8b4dc4847
commit
8145572180
Notes:
github-actions[bot]
2025-06-02 21:10:26 +00:00
Author: https://github.com/trflynn89
Commit: 8145572180
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4966
4 changed files with 92 additions and 12 deletions
|
@ -403,13 +403,15 @@ Vector<Crypto::SignedBigInteger> get_named_time_zone_epoch_nanoseconds(StringVie
|
|||
auto local_nanoseconds = get_utc_epoch_nanoseconds(iso_date_time);
|
||||
auto local_time = UnixDateTime::from_nanoseconds_since_epoch(clip_bigint_to_sane_time(local_nanoseconds));
|
||||
|
||||
// FIXME: LibUnicode does not behave exactly as the spec expects. It does not consider repeated or skipped time points.
|
||||
auto offset = Unicode::time_zone_offset(time_zone_identifier, local_time);
|
||||
auto offsets = Unicode::disambiguated_time_zone_offsets(time_zone_identifier, local_time);
|
||||
|
||||
// Can only fail if the time zone identifier is invalid, which cannot be the case here.
|
||||
VERIFY(offset.has_value());
|
||||
Vector<Crypto::SignedBigInteger> result;
|
||||
result.ensure_capacity(offsets.size());
|
||||
|
||||
return { local_nanoseconds.minus(Crypto::SignedBigInteger { offset->offset.to_nanoseconds() }) };
|
||||
for (auto const& offset : offsets)
|
||||
result.unchecked_append(local_nanoseconds.minus(Crypto::SignedBigInteger { offset.offset.to_nanoseconds() }));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 21.4.1.21 GetNamedTimeZoneOffsetNanoseconds ( timeZoneIdentifier, epochNanoseconds ), https://tc39.es/ecma262/#sec-getnamedtimezoneoffsetnanoseconds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue