summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-06-06 17:05:15 +0100
committerAndreas Kling <kling@serenityos.org>2021-06-06 19:34:43 +0200
commitff5aa3ca70198cc9879d1365f3dfe0dceb6b312e (patch)
tree57a9652d4f3e3c5a4619276fef4234f4ca840f34 /Userland/Libraries/LibJS
parent60aace8400ee57aecd31f760356a6ddfe3b4d8e8 (diff)
downloadserenity-ff5aa3ca70198cc9879d1365f3dfe0dceb6b312e.zip
LibJS: Make it so that Date.prototype.toGMTString === .toUTCString
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/DatePrototype.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp
index 4bef4e1367..4091fc7353 100644
--- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp
@@ -63,7 +63,6 @@ void DatePrototype::initialize(GlobalObject& global_object)
define_native_function(vm.names.getUTCMonth, get_utc_month, 0, attr);
define_native_function(vm.names.getUTCSeconds, get_utc_seconds, 0, attr);
define_native_function(vm.names.toDateString, to_date_string, 0, attr);
- define_native_function(vm.names.toGMTString, to_gmt_string, 0, attr);
define_native_function(vm.names.toUTCString, to_utc_string, 0, attr);
define_native_function(vm.names.toISOString, to_iso_string, 0, attr);
define_native_function(vm.names.toLocaleDateString, to_locale_date_string, 0, attr);
@@ -74,6 +73,12 @@ void DatePrototype::initialize(GlobalObject& global_object)
// Aliases.
define_native_function(vm.names.valueOf, get_time, 0, attr);
+
+ // https://tc39.es/ecma262/#sec-date.prototype.togmtstring
+ // The function object that is the initial value of Date.prototype.toGMTString
+ // is the same function object that is the initial value of Date.prototype.toUTCString.
+ define_property(vm.names.toGMTString, get(vm.names.toUTCString), attr);
+
// toJSON() isn't quite an alias for toISOString():
// - it returns null instead of throwing RangeError
// - its .length is 1, not 0