mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Implement Temporal.Calendar.prototype.month
This commit is contained in:
parent
8434ca6c4b
commit
3bec18432a
Notes:
sideshowbarker
2024-07-18 08:28:14 +09:00
Author: https://github.com/IdanHo
Commit: 3bec18432a
Pull-request: https://github.com/SerenityOS/serenity/pull/8961
Reviewed-by: https://github.com/linusg ✅
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