mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Pass time zone strings around as String more regularly
These are String from the outset, so this patch is almost entirely just changing function parameter types. This will allow us to cache time zone parse results without invoking any extra allocations.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
d065f6bf00
commit
f9fa548d43
Notes:
github-actions[bot]
2026-02-19 08:21:38 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f9fa548d43c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8019 Reviewed-by: https://github.com/gmta ✅
@@ -201,11 +201,11 @@ Crypto::SignedBigInteger round_temporal_instant(Crypto::SignedBigInteger const&
|
||||
}
|
||||
|
||||
// 8.5.8 TemporalInstantToString ( instant, timeZone, precision ), https://tc39.es/proposal-temporal/#sec-temporal-temporalinstanttostring
|
||||
String temporal_instant_to_string(Instant const& instant, Optional<StringView> time_zone, SecondsStringPrecision::Precision precision)
|
||||
String temporal_instant_to_string(Instant const& instant, Optional<String const&> time_zone, SecondsStringPrecision::Precision precision)
|
||||
{
|
||||
// 1. Let outputTimeZone be timeZone.
|
||||
// 2. If outputTimeZone is undefined, set outputTimeZone to "UTC".
|
||||
auto output_time_zone = time_zone.value_or("UTC"sv);
|
||||
auto const& output_time_zone = time_zone.value_or(UTC_TIME_ZONE);
|
||||
|
||||
// 3. Let epochNs be instant.[[EpochNanoseconds]].
|
||||
auto const& epoch_nanoseconds = instant.epoch_nanoseconds()->big_integer();
|
||||
|
||||
Reference in New Issue
Block a user