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

LibJS: Implement Temporal.PlainDate.prototype.dayOfWeek

This commit is contained in:
Idan Horowitz 2021-07-23 17:50:35 +03:00 committed by Linus Groh
parent 339b0a17e8
commit bcbfd5b280
5 changed files with 43 additions and 0 deletions

View file

@ -203,6 +203,16 @@ double calendar_day(GlobalObject& global_object, Object& calendar, Object& date_
return to_positive_integer_or_infinity(global_object, result);
}
// 12.1.13 CalendarDayOfWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardayofweek
Value calendar_day_of_week(GlobalObject& global_object, Object& calendar, Object& date_like)
{
auto& vm = global_object.vm();
// 1. Assert: Type(calendar) is Object.
// 2. Return ? Invoke(calendar, "dayOfWeek", « dateLike »).
return calendar.invoke(vm.names.dayOfWeek, &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)
{