wa-lang.org/wazero@v1.0.2/internal/gojs/time.go (about)

     1  package gojs
     2  
     3  import (
     4  	"context"
     5  
     6  	"wa-lang.org/wazero/api"
     7  )
     8  
     9  var (
    10  	// jsDateConstructor returns jsDate.
    11  	//
    12  	// This is defined as `Get("Date")` in zoneinfo_js.go time.initLocal
    13  	jsDateConstructor = newJsVal(refJsDateConstructor, "Date")
    14  
    15  	// jsDate is used inline in zoneinfo_js.go for time.initLocal.
    16  	// `.Call("getTimezoneOffset").Int()` returns a timezone offset.
    17  	jsDate = newJsVal(refJsDate, "jsDate").
    18  		addFunction("getTimezoneOffset", &getTimezoneOffset{})
    19  )
    20  
    21  type getTimezoneOffset struct{}
    22  
    23  // invoke implements jsFn.invoke
    24  func (*getTimezoneOffset) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
    25  	return uint32(0), nil // UTC
    26  }