mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibLocale: Parse day-period hour cycle preferences
For example, the locale "fr-FR" will have the preferred hour cycle list of "H hB", meaning h23 and h12-with-day-periods. Whether date-times are actually formatted with day-periods is up to the user, but we need to parse the hour cycle as h12 to know that the FR region supports h12. This bug was revealed by LibJS no longer blindly falling back to h12 (if the `hour12` option is true) or h24 (if the `hour12` option is false).
This commit is contained in:
parent
05e080c4ba
commit
eeb16f03bb
2 changed files with 14 additions and 2 deletions
|
@ -575,9 +575,9 @@ static ErrorOr<void> parse_hour_cycles(DeprecatedString core_path, CLDR& cldr)
|
|||
auto const& time_data_object = supplemental_object.get_object("timeData"sv).value();
|
||||
|
||||
auto parse_hour_cycle = [](StringView hour_cycle) -> Optional<Locale::HourCycle> {
|
||||
if (hour_cycle == "h"sv)
|
||||
if (hour_cycle.is_one_of("h"sv, "hb"sv, "hB"sv))
|
||||
return Locale::HourCycle::H12;
|
||||
if (hour_cycle == "H"sv)
|
||||
if (hour_cycle.is_one_of("H"sv, "Hb"sv, "HB"sv))
|
||||
return Locale::HourCycle::H23;
|
||||
if (hour_cycle == "K"sv)
|
||||
return Locale::HourCycle::H11;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue