diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-12-13 10:12:48 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-14 15:24:48 +0000 |
commit | 897c7f7cc285b704e0240d2051a236ecc4e2e326 (patch) | |
tree | 755db5e5d4533e9c152e2acedd3755e0597191ed /Userland/Libraries/LibJS/Runtime | |
parent | d382e77d38cff6e833d6a59ff8c6179a2b3e6ad9 (diff) | |
download | serenity-897c7f7cc285b704e0240d2051a236ecc4e2e326.zip |
LibJS: Set DateTimeFormat's time zone when the CLDR download is disabled
We return early from the DateTimeFormat constructor to avoid crashing on
assertions when the CLDR is disabled. However, after commit 019211b, the
spec now mandates we assert the time zone identifier is valid. The early
return resulted in this identifier being an empty string.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp index 5e85043ac8..49baca561b 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp @@ -169,8 +169,10 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF auto default_hour_cycle = ::Locale::get_default_regional_hour_cycle(data_locale); // Non-standard, default_hour_cycle will be empty if Unicode data generation is disabled. - if (!default_hour_cycle.has_value()) + if (!default_hour_cycle.has_value()) { + date_time_format.set_time_zone(default_time_zone()); return &date_time_format; + } Optional<::Locale::HourCycle> hour_cycle_value; |