mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:27:34 +00:00
LibJS: Implement Temporal.Calendar.prototype.month
This commit is contained in:
parent
8434ca6c4b
commit
3bec18432a
5 changed files with 60 additions and 0 deletions
|
@ -453,4 +453,19 @@ i32 iso_year(Object& temporal_object)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// 12.1.42 ISOMonth ( temporalObject ), https://tc39.es/proposal-temporal/#sec-temporal-isomonth
|
||||
u8 iso_month(Object& temporal_object)
|
||||
{
|
||||
// 1. Assert: temporalObject has an [[ISOMonth]] internal slot.
|
||||
// NOTE: Asserted by the VERIFY_NOT_REACHED at the end
|
||||
|
||||
// 2. Return 𝔽(temporalObject.[[ISOMonth]]).
|
||||
// TODO: add the rest of the builtins with a [[ISOMonth]] slot (PlainYearMonth, PlainMonthDay)
|
||||
if (is<PlainDate>(temporal_object))
|
||||
return static_cast<PlainDate&>(temporal_object).iso_month();
|
||||
if (is<PlainDateTime>(temporal_object))
|
||||
return static_cast<PlainDateTime&>(temporal_object).iso_month();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue