The package seems to suggest it supports go time.Time objects and parsing them into Javascript dates, however with a minimal working example this doesn't seem to work:
vm := otto.New()
vm.Set("subject", time.Date(2024, 1, 15, 10, 30, 45, 0, time.UTC))
value, err := vm.Run(`
console.log("The value of subject is " + typeof(subject));
console.log("The subject is " + subject.toISOString());
subject;
`)
if err != nil {
return err
}
spew.Dump(value)
The value of subject is object
TypeError: "toISOString" is not a function
The package seems to suggest it supports go time.Time objects and parsing them into Javascript dates, however with a minimal working example this doesn't seem to work:
outputs: