mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +00:00
LibJS: Avoid calling ToString on calendar when calendarName is "never"
This is a normative change in the Temporal spec. See: -6122f4e
-cf586bc
This commit is contained in:
parent
0d7b634313
commit
54bb6bf2c0
8 changed files with 115 additions and 33 deletions
|
@ -281,13 +281,10 @@ ThrowCompletionOr<String> temporal_date_time_to_string(VM& vm, i32 iso_year, u8
|
|||
// 7. Let seconds be ! FormatSecondsStringPart(second, millisecond, microsecond, nanosecond, precision).
|
||||
auto seconds = format_seconds_string_part(second, millisecond, microsecond, nanosecond, precision);
|
||||
|
||||
// 8. Let calendarID be ? ToString(calendar).
|
||||
auto calendar_id = TRY(calendar.to_string(vm));
|
||||
// 8. Let calendarString be ? MaybeFormatCalendarAnnotation(calendar, showCalendar).
|
||||
auto calendar_string = TRY(maybe_format_calendar_annotation(vm, calendar, show_calendar));
|
||||
|
||||
// 9. Let calendarString be ! FormatCalendarAnnotation(calendarID, showCalendar).
|
||||
auto calendar_string = format_calendar_annotation(calendar_id, show_calendar);
|
||||
|
||||
// 10. Return the string-concatenation of year, the code unit 0x002D (HYPHEN-MINUS), month, the code unit 0x002D (HYPHEN-MINUS), day, 0x0054 (LATIN CAPITAL LETTER T), hour, the code unit 0x003A (COLON), minute, seconds, and calendarString.
|
||||
// 9. Return the string-concatenation of year, the code unit 0x002D (HYPHEN-MINUS), month, the code unit 0x002D (HYPHEN-MINUS), day, 0x0054 (LATIN CAPITAL LETTER T), hour, the code unit 0x003A (COLON), minute, seconds, and calendarString.
|
||||
return String::formatted("{}-{:02}-{:02}T{:02}:{:02}{}{}", pad_iso_year(iso_year), iso_month, iso_day, hour, minute, seconds, calendar_string);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue