mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 12:17:52 +00:00
LibJS: Implement Temporal.Calendar.prototype.monthCode
This commit is contained in:
parent
a0af9b11fb
commit
9d9ba29cae
Notes:
sideshowbarker
2024-07-18 08:28:06 +09:00
Author: https://github.com/IdanHo
Commit: 9d9ba29cae
Pull-request: https://github.com/SerenityOS/serenity/pull/8961
Reviewed-by: https://github.com/linusg ✅
5 changed files with 56 additions and 0 deletions
|
@ -489,4 +489,19 @@ u8 iso_month(Object& temporal_object)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// 12.1.43 ISOMonthCode ( temporalObject ), https://tc39.es/proposal-temporal/#sec-temporal-isomonthcode
|
||||
String iso_month_code(Object& temporal_object)
|
||||
{
|
||||
// 1. Assert: temporalObject has an [[ISOMonth]] internal slot.
|
||||
// NOTE: Asserted by the VERIFY_NOT_REACHED at the end
|
||||
|
||||
// 2. Return ! BuildISOMonthCode(temporalObject.[[ISOMonth]]).
|
||||
// TODO: add the rest of the builtins with a [[ISOMonth]] slot (PlainYearMonth, PlainMonthDay)
|
||||
if (is<PlainDate>(temporal_object))
|
||||
return build_iso_month_code(static_cast<PlainDate&>(temporal_object).iso_month());
|
||||
if (is<PlainDateTime>(temporal_object))
|
||||
return build_iso_month_code(static_cast<PlainDateTime&>(temporal_object).iso_month());
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue