|
@@ -26,6 +26,7 @@ void InstantPrototype::initialize(GlobalObject& global_object)
|
|
|
define_native_accessor(vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable);
|
|
|
define_native_accessor(vm.names.epochMicroseconds, epoch_microseconds_getter, {}, Attribute::Configurable);
|
|
|
+ define_native_accessor(vm.names.epochNanoseconds, epoch_nanoseconds_getter, {}, Attribute::Configurable);
|
|
|
|
|
|
// 8.3.2 Temporal.Instant.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype-@@tostringtag
|
|
|
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Instant"), Attribute::Configurable);
|
|
@@ -101,4 +102,20 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_microseconds_getter)
|
|
|
return js_bigint(vm.heap(), move(us));
|
|
|
}
|
|
|
|
|
|
+// 8.3.6 get Temporal.Instant.prototype.epochNanoseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochnanoseconds
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_nanoseconds_getter)
|
|
|
+{
|
|
|
+ // 1. Let instant be the this value.
|
|
|
+ // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
|
|
|
+ auto* instant = typed_this(global_object);
|
|
|
+ if (vm.exception())
|
|
|
+ return {};
|
|
|
+
|
|
|
+ // 3. Let ns be instant.[[Nanoseconds]].
|
|
|
+ auto& ns = instant->nanoseconds();
|
|
|
+
|
|
|
+ // 4. Return ns.
|
|
|
+ return &ns;
|
|
|
+}
|
|
|
+
|
|
|
}
|