Skip to content

time: location data always falls back to UTC in js/wasm #28265

@eternal-flame-AD

Description

@eternal-flame-AD

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ef/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ef/code/go/"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build929309457=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build and run the following snippet both in linux/amd64(local architecture) and wasm/js

package main

import (
	"fmt"
	"time"
)

func main() {
	fmt.Println(time.Now().Location())
}

What did you expect to see?

The results should be consisitent with the following javascript code, which should return the OS timezone info:

console.log(Intl.DateTimeFormat().resolvedOptions().timeZone)

What did you see instead?

On native architecture(linux/amd64):

Asia/Shanghai

On browser javascript:

Asia/Shanghai

On wasm:

UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-wasmWebAssembly issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions