1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LibJS: Read properties from the Intl.DateTimeFormat options object once

This is a normative change in the ECMA-402 spec. See:
02bd03a

This is observable just due to reading the properties one less time. It
would have been possible for e.g. the property values to change between
those invocations.
This commit is contained in:
Timothy Flynn 2023-07-21 22:13:44 -04:00 committed by Linus Groh
parent 3a4cdf77ba
commit 8b23bbf58e
5 changed files with 154 additions and 173 deletions

View file

@ -147,18 +147,6 @@ private:
String m_data_locale;
};
enum class OptionRequired {
Any,
Date,
Time,
};
enum class OptionDefaults {
All,
Date,
Time,
};
// Table 8: Record returned by ToLocalTime, https://tc39.es/ecma402/#table-datetimeformat-tolocaltime-record
// Note: [[InDST]] is not included here - it is handled by LibUnicode / LibTimeZone.
struct LocalTime {
@ -180,7 +168,6 @@ struct LocalTime {
u16 millisecond { 0 }; // [[Millisecond]]
};
ThrowCompletionOr<Object*> to_date_time_options(VM&, Value options_value, OptionRequired, OptionDefaults);
ThrowCompletionOr<Optional<::Locale::CalendarPattern>> date_time_style_format(VM&, StringView data_locale, DateTimeFormat& date_time_format);
Optional<::Locale::CalendarPattern> basic_format_matcher(::Locale::CalendarPattern const& options, Vector<::Locale::CalendarPattern> formats);
Optional<::Locale::CalendarPattern> best_fit_format_matcher(::Locale::CalendarPattern const& options, Vector<::Locale::CalendarPattern> formats);