mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
LibCore+LibJS+LibUnicode: Port retrieving time zone offsets to ICU
The changes to tests are due to LibTimeZone incorrectly interpreting time stamps in the TZDB. The TZDB will list zone transitions in either UTC or the zone's local time (which is then subject to DST offsets). LibTimeZone did not handle the latter at all. For example: The following rule is in effect until November 18, 6PM UTC. America/Chicago -5:50:36 - LMT 1883 Nov 18 18:00u The following rule is in effect until March 1, 2AM in Chicago time. But at that time, a DST transition occurs, so the local time is actually 3AM. America/Chicago -6:00 Chicago C%sT 1936 Mar 1 2:00
This commit is contained in:
parent
1b2d47e6bb
commit
672a555f98
Notes:
sideshowbarker
2024-07-17 08:45:34 +09:00
Author: https://github.com/trflynn89
Commit: 672a555f98
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/281
15 changed files with 155 additions and 51 deletions
|
@ -6,15 +6,27 @@
|
|||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Unicode {
|
||||
|
||||
struct TimeZoneOffset {
|
||||
enum class InDST {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
Duration offset;
|
||||
InDST in_dst { InDST::No };
|
||||
};
|
||||
|
||||
String current_time_zone();
|
||||
Vector<String> const& available_time_zones();
|
||||
Vector<String> available_time_zones_in_region(StringView region);
|
||||
Optional<String> resolve_primary_time_zone(StringView time_zone);
|
||||
Optional<TimeZoneOffset> time_zone_offset(StringView time_zone, UnixDateTime time);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue