New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: Fix toml zoneinfo inconsistency #10157
Conversation
TOML's time representation has known issues about zoneinfo name such as `PDT` - gohugoio#9082 - gohugoio#9982 - gohugoio#8895 - gohugoio#9996 These are caused because * TOML's time format has only offset - zoneinfo cannot be retrieved with offset value * `TZ` environment variable can change the behaviour * `cast.ToTimeInDefaultLocationE` may or may not use `location` arg Given that hugo often is used on both local and remote machine, and as * `TZ` envvar should not have any effect on this - Remote environments can be hard to debug * If only `timeZone` is set explicitly in config file and offsets of time are matched with it, hugo should show zoneinfo - Otherwise, zoneinfo should not be displayed * hugo should handle TOML's time object and time string equally To meet these, * assure to set `location` derived from conf to time of TOML if possible * add tests Close gohugoio#9996
Changing `TZ` between tests has no effect because the initialization only occurs once during running. - Change `time.Local` global variable between tests - Fix and add test cases - Fix implementation
Sorry, but I don't understand the commit message "time: Fix toml zoneinfo inconsistency". This PR seems to be more about making this configuration work by ignoring the OS tzdata:
Most sites have not set |
We could possibly apply this fix only when the locale is established from config. Not sure. |
It was my intention to show no zone info if config does not have |
This PR has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
TOML's time representation has known issues about zoneinfo name such as
PDT
in hugogo-toml
#9082These are caused because
TZ
environment variable can change the behaviourcast.ToTimeInDefaultLocationE
may or may not uselocation
argGiven that hugo often is used on both local and remote machine, and as #9996 said hugo supports multilingual site generation,
TZ
envvar should not have any effect on thistime.Local
(exception)timeZone
is set explicitly in config file and offsets oftime are matched with it, hugo should show zoneinfo
To meet these,
location
derived from conf to time of TOML if possibleClose #9996