|
@@ -24,6 +24,7 @@ void TimeZonePrototype::initialize(GlobalObject& global_object)
|
|
|
|
|
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
|
|
define_native_function(vm.names.toString, to_string, 0, attr);
|
|
|
+ define_native_function(vm.names.toJSON, to_json, 0, attr);
|
|
|
|
|
|
// 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag
|
|
|
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.TimeZone"), Attribute::Configurable);
|
|
@@ -55,4 +56,14 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_string)
|
|
|
return js_string(vm, time_zone->identifier());
|
|
|
}
|
|
|
|
|
|
+// 11.4.12 Temporal.TimeZone.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.tojson
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_json)
|
|
|
+{
|
|
|
+ // 1. Let timeZone be the this value.
|
|
|
+ auto time_zone = vm.this_value(global_object);
|
|
|
+
|
|
|
+ // 2. Return ? ToString(timeZone).
|
|
|
+ return js_string(vm, time_zone.to_string(global_object));
|
|
|
+}
|
|
|
+
|
|
|
}
|