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

LibJS: Update spec comments to use ToZeroPaddedDecimalString AO

This is an editorial change in the ECMA-262 and Temporal specs.

See:
- 843d8b8
- f9211d9

Note that we don't actually need to implement the AO as we already have
String::formatted() for this, and use unified format strings instead of
zero-padding in individual steps in many cases anyway.
This commit is contained in:
Linus Groh 2022-04-12 22:20:33 +01:00
parent 431a9938a8
commit 5397278bfc
10 changed files with 41 additions and 45 deletions

View file

@ -176,8 +176,8 @@ ThrowCompletionOr<String> temporal_month_day_to_string(GlobalObject& global_obje
// 1. Assert: Type(monthDay) is Object.
// 2. Assert: monthDay has an [[InitializedTemporalMonthDay]] internal slot.
// 3. Let month be monthDay.[[ISOMonth]] formatted as a two-digit decimal number, padded to the left with a zero if necessary.
// 4. Let day be monthDay.[[ISODay]] formatted as a two-digit decimal number, padded to the left with a zero if necessary.
// 3. Let month be ToZeroPaddedDecimalString(temporalDate.[[ISOMonth]], 2).
// 4. Let day be ToZeroPaddedDecimalString(temporalDate.[[ISODay]], 2).
// 5. Let result be the string-concatenation of month, the code unit 0x002D (HYPHEN-MINUS), and day.
auto result = String::formatted("{:02}-{:02}", month_day.iso_month(), month_day.iso_day());