1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibJS: Port pad_iso_year() to String

This commit is contained in:
Linus Groh 2023-01-26 15:54:09 +00:00
parent 2aa4fcc318
commit 453d3063f5
5 changed files with 9 additions and 9 deletions

View file

@ -264,7 +264,7 @@ ThrowCompletionOr<DeprecatedString> temporal_date_time_to_string(VM& vm, i32 iso
auto calendar_string = TRY(maybe_format_calendar_annotation(vm, calendar, show_calendar));
// 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 DeprecatedString::formatted("{}-{:02}-{:02}T{:02}:{:02}{}{}", pad_iso_year(iso_year), iso_month, iso_day, hour, minute, seconds, calendar_string);
return DeprecatedString::formatted("{}-{:02}-{:02}T{:02}:{:02}{}{}", MUST_OR_THROW_OOM(pad_iso_year(vm, iso_year)), iso_month, iso_day, hour, minute, seconds, calendar_string);
}
// 5.5.7 CompareISODateTime ( y1, mon1, d1, h1, min1, s1, ms1, mus1, ns1, y2, mon2, d2, h2, min2, s2, ms2, mus2, ns2 ), https://tc39.es/proposal-temporal/#sec-temporal-compareisodatetime