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

LibJS: Implement Temporal.PlainDate.prototype.inLeapYear

This commit is contained in:
Idan Horowitz 2021-07-23 19:04:43 +03:00 committed by Linus Groh
parent c9ae7e1af1
commit 1d76be97f5
5 changed files with 45 additions and 0 deletions

View file

@ -273,6 +273,16 @@ Value calendar_months_in_year(GlobalObject& global_object, Object& calendar, Obj
return calendar.invoke(vm.names.monthsInYear, &date_like);
}
// 12.1.20 CalendarInLeapYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarinleapyear
Value calendar_in_leap_year(GlobalObject& global_object, Object& calendar, Object& date_like)
{
auto& vm = global_object.vm();
// 1. Assert: Type(calendar) is Object.
// 2. Return ? Invoke(calendar, "inLeapYear", « dateLike »).
return calendar.invoke(vm.names.inLeapYear, &date_like);
}
// 12.1.21 ToTemporalCalendar ( temporalCalendarLike ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalcalendar
Object* to_temporal_calendar(GlobalObject& global_object, Value temporal_calendar_like)
{