|
@@ -37,6 +37,7 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
|
|
|
define_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable);
|
|
|
+ define_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable);
|
|
|
|
|
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
|
|
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
|
@@ -199,6 +200,19 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter)
|
|
|
return Value(date_time->iso_microsecond());
|
|
|
}
|
|
|
|
|
|
+// 5.3.13 get Temporal.PlainDateTime.prototype.nanosecond, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.nanosecond
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_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. Return 𝔽(dateTime.[[ISONanosecond]]).
|
|
|
+ return Value(date_time->iso_nanosecond());
|
|
|
+}
|
|
|
+
|
|
|
// 5.3.35 Temporal.PlainDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.valueof
|
|
|
JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::value_of)
|
|
|
{
|