mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
LibJS: Implement Temporal.Calendar.from()
This commit is contained in:
parent
a91848c148
commit
dc80a258f6
3 changed files with 35 additions and 0 deletions
|
@ -25,6 +25,9 @@ void CalendarConstructor::initialize(GlobalObject& global_object)
|
|||
// 12.3.1 Temporal.Calendar.prototype, https://tc39.es/proposal-temporal/#sec-temporal-calendar-prototype
|
||||
define_direct_property(vm.names.prototype, global_object.temporal_calendar_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.from, from, 1, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
@ -61,4 +64,13 @@ Value CalendarConstructor::construct(FunctionObject& new_target)
|
|||
return create_temporal_calendar(global_object, identifier, &new_target);
|
||||
}
|
||||
|
||||
// 12.3.2 Temporal.Calendar.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.from
|
||||
JS_DEFINE_NATIVE_FUNCTION(CalendarConstructor::from)
|
||||
{
|
||||
auto item = vm.argument(0);
|
||||
|
||||
// 1. Return ? ToTemporalCalendar(item).
|
||||
return to_temporal_calendar(global_object, item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue