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

LibJS: Use narrower types in Temporal PlainDate/PlainDateTime/Calendar

These are bounds-checked during construction of PlainDate/PlainDateTime
and as such theres no need to widen them in these internal AO calls.
This commit is contained in:
Idan Horowitz 2021-07-26 16:48:47 +03:00 committed by Linus Groh
parent c5c32ad274
commit 2c6bd3a61b
11 changed files with 47 additions and 49 deletions

View file

@ -460,7 +460,7 @@ u16 iso_days_in_year(i32 year)
}
// 12.1.32 ISODaysInMonth ( year, month ), https://tc39.es/proposal-temporal/#sec-temporal-isodaysinmonth
i32 iso_days_in_month(i32 year, i32 month)
u8 iso_days_in_month(i32 year, u8 month)
{
// 1. Assert: year is an integer.
@ -547,7 +547,7 @@ u8 to_iso_week_of_year(i32 year, u8 month, u8 day)
}
// 12.1.36 BuildISOMonthCode ( month ), https://tc39.es/proposal-temporal/#sec-buildisomonthcode
String build_iso_month_code(i32 month)
String build_iso_month_code(u8 month)
{
return String::formatted("M{:02}", month);
}