Skip to content

Commit

Permalink
Fix local time when TZ is not set (#1649)
Browse files Browse the repository at this point in the history
Do not override time.Local when TZ is empty or unset. It is already set correctly by go standard library.
  • Loading branch information
balki authored Sep 17, 2024
1 parent 5ef01ca commit d1767e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/lib/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
// statement does 'ENV["TZ"] = Asia/Istanbul'.
func SetTZFromEnv() error {
tzenv := os.Getenv("TZ")
if tzenv == "" {
return nil
}
location, err := time.LoadLocation(tzenv)
if err != nil {
return fmt.Errorf("TZ environment variable appears malformed: \"%s\"", tzenv)
Expand Down

0 comments on commit d1767e7

Please sign in to comment.