mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-11 14:23:25 +00:00
fix(codemode): align string, array, and Date behavior (#37775)
This commit is contained in:
parent
fe0c74f4df
commit
391cfbcfe7
6 changed files with 165 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue