Skip to content

Commit

Permalink
Fix local time when TZ is not set
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 dbdc293
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 dbdc293

Please sign in to comment.