|
@@ -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
|
|
// 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);
|
|
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);
|
|
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);
|
|
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);
|
|
|
|
+}
|
|
|
|
+
|
|
}
|
|
}
|