From 2ed7f75e95b9eb636ffdc4db7e9dc1bb39bc0fc3 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 13 Feb 2021 12:37:02 +0100 Subject: [PATCH] LibJS: Return empty value on exception in Date.parse(), not NaN This is discarded anyway, so let's not confuse ourselves by returning a NaN number value that's not going to be used. --- Userland/Libraries/LibJS/Runtime/DateConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index c07fe514f3..5bd828a4d9 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -229,7 +229,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateConstructor::parse) auto iso_8601 = vm.argument(0).to_string(global_object); if (vm.exception()) - return js_nan(); + return {}; return parse_simplified_iso8601(iso_8601); }