diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1341b2c8..87492cb8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,6 +22,12 @@ 3000, 3333 ], + // "initializeCommand" to get host timezone + "initializeCommand": "powershell -File .\\.devcontainer\\getHostTimeZone.ps1 || echo ''", + // set container timezone + "remoteEnv": { + "TZ": "${localEnv:TZ}" + }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "sh .devcontainer/post-create.sh", // Configure tool-specific properties. diff --git a/.devcontainer/getHostTimeZone.ps1 b/.devcontainer/getHostTimeZone.ps1 new file mode 100644 index 00000000..d02dc684 --- /dev/null +++ b/.devcontainer/getHostTimeZone.ps1 @@ -0,0 +1,4 @@ +$env:TZ = [Windows.Globalization.Calendar,Windows.Globalization,ContentType=WindowsRuntime]::New().GetTimeZone() +[Environment]::SetEnvironmentVariable('TZ', "$env:TZ", 'Process') +[Environment]::SetEnvironmentVariable('TZ', "$env:TZ", 'User') +Write-Host "Host timezone: $env:TZ" \ No newline at end of file