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

LibJS: Format the era of ISO year 0 as BC

This is a normative change in the ECMA-402 spec. See:
2034315
This commit is contained in:
Timothy Flynn 2023-02-01 21:03:59 +00:00 committed by Linus Groh
parent f0312de7eb
commit bb4fda3b97
2 changed files with 13 additions and 2 deletions

View file

@ -1235,8 +1235,8 @@ ThrowCompletionOr<LocalTime> to_local_time(VM& vm, Crypto::SignedBigInteger cons
return LocalTime {
// WeekDay(𝔽(floor(tz / 10^6)))
.weekday = week_day(zoned_time),
// Let year be YearFromTime(𝔽(floor(tz / 10^6))). If year < -0𝔽, return "BC", else return "AD".
.era = year < 0 ? ::Locale::Era::BC : ::Locale::Era::AD,
// Let year be YearFromTime(𝔽(floor(tz / 10^6))). If year < 1𝔽, return "BC", else return "AD".
.era = year < 1 ? ::Locale::Era::BC : ::Locale::Era::AD,
// YearFromTime(𝔽(floor(tz / 10^6)))
.year = year,
// undefined.