mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 19:24:57 +00:00
LibJS+LibUnicode: Return the appropriate time zone name depending on DST
This commit is contained in:
parent
bf677eb485
commit
4400150cd2
5 changed files with 79 additions and 26 deletions
|
@ -2207,17 +2207,17 @@ static TimeZoneNames const* find_time_zone_names(StringView locale, StringView t
|
|||
return &s_time_zones[time_zone_index];
|
||||
}
|
||||
|
||||
Optional<StringView> get_time_zone_name(StringView locale, StringView time_zone, CalendarPatternStyle style)
|
||||
Optional<StringView> get_time_zone_name(StringView locale, StringView time_zone, CalendarPatternStyle style, TimeZone::InDST in_dst)
|
||||
{
|
||||
if (auto const* data = find_time_zone_names(locale, time_zone); data != nullptr) {
|
||||
size_t name_index = 0;
|
||||
|
||||
switch (style) {
|
||||
case CalendarPatternStyle::Short:
|
||||
name_index = data->short_standard_name;
|
||||
name_index = (in_dst == TimeZone::InDST::No) ? data->short_standard_name : data->short_daylight_name;
|
||||
break;
|
||||
case CalendarPatternStyle::Long:
|
||||
name_index = data->long_standard_name;
|
||||
name_index = (in_dst == TimeZone::InDST::No) ? data->long_standard_name : data->long_daylight_name;
|
||||
break;
|
||||
case CalendarPatternStyle::ShortGeneric:
|
||||
name_index = data->short_generic_name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue