|
@@ -45,6 +45,7 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
|
|
|
define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable);
|
|
|
+ define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable);
|
|
|
|
|
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
|
|
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
|
@@ -332,6 +333,22 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
|
|
|
return calendar_months_in_year(global_object, calendar, *date_time);
|
|
|
}
|
|
|
|
|
|
+// 5.3.21 get Temporal.PlainDateTime.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.inleapyear
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter)
|
|
|
+{
|
|
|
+ // 1. Let dateTime be the this value.
|
|
|
+ // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
|
|
|
+ auto* date_time = typed_this(global_object);
|
|
|
+ if (vm.exception())
|
|
|
+ return {};
|
|
|
+
|
|
|
+ // 3. Let calendar be dateTime.[[Calendar]].
|
|
|
+ auto& calendar = date_time->calendar();
|
|
|
+
|
|
|
+ // 4. Return ? CalendarInLeapYear(calendar, dateTime).
|
|
|
+ return calendar_in_leap_year(global_object, calendar, *date_time);
|
|
|
+}
|
|
|
+
|
|
|
// 5.3.35 Temporal.PlainDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.valueof
|
|
|
JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::value_of)
|
|
|
{
|