fix(codemode): align string, array, and Date behavior (#37775)

This commit is contained in:
Aiden Cline
2026-07-19 21:41:06 -05:00
committed by GitHub
parent fe0c74f4df
commit 391cfbcfe7
6 changed files with 165 additions and 36 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ export const invokeDateMethod = (value: CodeModeDate, name: string, node: AstNod
case "valueOf":
return value.time
case "toISOString":
if (!Number.isFinite(value.time)) throw new InterpreterRuntimeError("Invalid time value.", node)
if (!Number.isFinite(value.time)) throw new InterpreterRuntimeError("Invalid time value.", node).as("RangeError")
return hosted.toISOString()
case "toJSON":
return Number.isFinite(value.time) ? hosted.toISOString() : null