time.go 561 B

123456789101112131415161718
  1. package jsc
  2. import (
  3. "time"
  4. _ "unsafe"
  5. "github.com/dop251/goja"
  6. )
  7. func TimeToValue(runtime *goja.Runtime, time time.Time) goja.Value {
  8. return runtimeNewDateObject(runtime, time, true, runtimeGetDatePrototype(runtime))
  9. }
  10. //go:linkname runtimeNewDateObject github.com/dop251/goja.(*Runtime).newDateObject
  11. func runtimeNewDateObject(r *goja.Runtime, t time.Time, isSet bool, proto *goja.Object) *goja.Object
  12. //go:linkname runtimeGetDatePrototype github.com/dop251/goja.(*Runtime).getDatePrototype
  13. func runtimeGetDatePrototype(r *goja.Runtime) *goja.Object