1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:07:34 +00:00

LibJS: Make it so that Date.prototype.toGMTString === .toUTCString

This commit is contained in:
Linus Groh 2021-06-06 17:05:15 +01:00 committed by Andreas Kling
parent 60aace8400
commit ff5aa3ca70

View file

@ -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