1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibJS: Cache the data locale used by Intl.DateTimeFormat

Unlike the locale, the data locale has Unicode locale extensions removed
(e.g. the data locale for "en-US-u-ca-gregory" is just "en-US"). Cache
the data locale for LibUnicode lookups during formatting.
This commit is contained in:
Timothy Flynn 2021-12-06 17:25:23 -05:00 committed by Linus Groh
parent 4cc8cf9233
commit d010ba10c3
2 changed files with 8 additions and 0 deletions

View file

@ -129,6 +129,9 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(GlobalObject& glo
// 23. Let dataLocale be r.[[dataLocale]].
auto data_locale = move(result.data_locale);
// Non-standard, the data locale is needed for LibUnicode lookups while formatting.
date_time_format.set_data_locale(data_locale);
// 24. Let timeZone be ? Get(options, "timeZone").
auto time_zone_value = TRY(options->get(vm.names.timeZone));
String time_zone;