1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:37:35 +00:00

LibJS: Change ToLocalTime to use epoch nanoseconds

This is an editorial change to the ECMA-402 spec. See:
b3f9a1b
This commit is contained in:
Timothy Flynn 2022-11-05 12:22:00 -04:00 committed by Linus Groh
parent 9a9025dea0
commit f211028252
2 changed files with 39 additions and 29 deletions

View file

@ -159,7 +159,7 @@ enum class OptionDefaults {
Time,
};
// Table 7: Record returned by ToLocalTime, https://tc39.es/ecma402/#table-datetimeformat-tolocaltime-record
// 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 {
AK::Time time_since_epoch() const
@ -191,7 +191,7 @@ ThrowCompletionOr<Array*> format_date_time_to_parts(VM&, DateTimeFormat&, double
ThrowCompletionOr<Vector<PatternPartitionWithSource>> partition_date_time_range_pattern(VM&, DateTimeFormat&, double start, double end);
ThrowCompletionOr<String> format_date_time_range(VM&, DateTimeFormat&, double start, double end);
ThrowCompletionOr<Array*> format_date_time_range_to_parts(VM&, DateTimeFormat&, double start, double end);
ThrowCompletionOr<LocalTime> to_local_time(VM&, double time, StringView calendar, StringView time_zone);
ThrowCompletionOr<LocalTime> to_local_time(VM&, Crypto::SignedBigInteger const& epoch_ns, StringView calendar, StringView time_zone);
template<typename Callback>
ThrowCompletionOr<void> for_each_calendar_field(VM& vm, ::Locale::CalendarPattern& pattern, Callback&& callback)