mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibTimeZone: Extract and parse the backwards compatibility LINK entries
This set of LINK entries contains the link from "UTC" to "Etc/UTC", which LibJS will heavily depend upon.
This commit is contained in:
committed by
Linus Groh
parent
b5758a0623
commit
87abf00f7c
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/87abf00f7c2 Pull-request: https://github.com/SerenityOS/serenity/pull/11699 Reviewed-by: https://github.com/linusg ✅
@@ -168,15 +168,17 @@ static ErrorOr<void> parse_time_zones(StringView time_zone_path, TimeZoneData& t
|
||||
|
||||
static String format_identifier(StringView owner, String identifier)
|
||||
{
|
||||
constexpr auto gmt_time_zone = "Etc/GMT"sv;
|
||||
constexpr auto gmt_time_zones = Array { "Etc/GMT"sv, "GMT"sv };
|
||||
|
||||
if (identifier.starts_with(gmt_time_zone)) {
|
||||
auto offset = identifier.substring_view(gmt_time_zone.length());
|
||||
for (auto gmt_time_zone : gmt_time_zones) {
|
||||
if (identifier.starts_with(gmt_time_zone)) {
|
||||
auto offset = identifier.substring_view(gmt_time_zone.length());
|
||||
|
||||
if (offset.starts_with('+'))
|
||||
identifier = String::formatted("{}_P{}", gmt_time_zone, offset.substring_view(1));
|
||||
else if (offset.starts_with('-'))
|
||||
identifier = String::formatted("{}_M{}", gmt_time_zone, offset.substring_view(1));
|
||||
if (offset.starts_with('+'))
|
||||
identifier = String::formatted("{}_P{}", gmt_time_zone, offset.substring_view(1));
|
||||
else if (offset.starts_with('-'))
|
||||
identifier = String::formatted("{}_M{}", gmt_time_zone, offset.substring_view(1));
|
||||
}
|
||||
}
|
||||
|
||||
identifier = identifier.replace("-"sv, "_"sv, true);
|
||||
|
||||
Reference in New Issue
Block a user