1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +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:
Timothy Flynn 2022-01-19 14:18:02 -05:00 committed by Linus Groh
parent 42c9c57141
commit 70f49d0696
7 changed files with 86 additions and 69 deletions

View file

@ -66,17 +66,17 @@ Optional<StringView> canonicalize_time_zone(StringView time_zone)
Optional<DaylightSavingsRule> __attribute__((weak)) daylight_savings_rule_from_string(StringView) { return {}; }
StringView __attribute__((weak)) daylight_savings_rule_to_string(DaylightSavingsRule) { return {}; }
Optional<i64> __attribute__((weak)) get_time_zone_offset([[maybe_unused]] TimeZone time_zone, AK::Time)
Optional<Offset> __attribute__((weak)) get_time_zone_offset([[maybe_unused]] TimeZone time_zone, AK::Time)
{
#if !ENABLE_TIME_ZONE_DATA
VERIFY(time_zone == TimeZone::UTC);
return 0;
return Offset {};
#else
return {};
#endif
}
Optional<i64> get_time_zone_offset(StringView time_zone, AK::Time time)
Optional<Offset> get_time_zone_offset(StringView time_zone, AK::Time time)
{
if (auto maybe_time_zone = time_zone_from_string(time_zone); maybe_time_zone.has_value())
return get_time_zone_offset(*maybe_time_zone, time);