mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
LibJS+LibTimeZone+LibUnicode: Indicate whether a time zone is in DST
Return whether the time zone is in DST during the provided time from TimeZone::get_time_zone_offset,
This commit is contained in:
parent
42c9c57141
commit
70f49d0696
7 changed files with 86 additions and 69 deletions
|
@ -286,7 +286,8 @@ double local_tza(double time, [[maybe_unused]] bool is_utc, Optional<StringView>
|
|||
|
||||
auto time_since_epoch = Value(time).is_finite_number() ? AK::Time::from_milliseconds(time) : AK::Time::max();
|
||||
auto maybe_offset = TimeZone::get_time_zone_offset(time_zone, time_since_epoch);
|
||||
return maybe_offset.value_or(0) * 1000;
|
||||
|
||||
return maybe_offset.has_value() ? static_cast<double>(maybe_offset->seconds) * 1000 : 0;
|
||||
}
|
||||
|
||||
// 21.4.1.8 LocalTime ( t ), https://tc39.es/ecma262/#sec-localtime
|
||||
|
|
|
@ -175,10 +175,10 @@ i64 get_iana_time_zone_offset_nanoseconds(BigInt const& epoch_nanoseconds, Strin
|
|||
else
|
||||
time = Time::from_seconds(*seconds.to_base(10).to_int<i64>());
|
||||
|
||||
auto offset_seconds = ::TimeZone::get_time_zone_offset(*time_zone, time);
|
||||
VERIFY(offset_seconds.has_value());
|
||||
auto offset = ::TimeZone::get_time_zone_offset(*time_zone, time);
|
||||
VERIFY(offset.has_value());
|
||||
|
||||
return *offset_seconds * 1'000'000'000;
|
||||
return offset->seconds * 1'000'000'000;
|
||||
}
|
||||
|
||||
// 11.6.5 GetIANATimeZoneNextTransition ( epochNanoseconds, timeZoneIdentifier ), https://tc39.es/proposal-temporal/#sec-temporal-getianatimezonenexttransition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue