Did I understand it correctly that the new timezone feature in v0.87 was only meant for display and not auto-adjusting the time itself?
I’ve been testing around and the only way for auto-adjust to work is if I use .UTC.Format or .Local.Format in the theme itself which also overrides all languages to displaying that timezone (UTC or system Local).
What I’m trying to achieve is the post will display its “Local” time based on the language of the post.
In my site config.toml I have this set per language: timeZone = "" Asia/Manila for en-ph; Asia/Tokyo for ja; Asia/Seoul for ko
In post.md I have this: date = "2021-08-15T09:40:35" (without the timezone, otherwise it will be fixed to that)
I removed the .UTC / .Local in the theme files, so it’s just .Date.Format now.
However, when I switch to a different language, the only thing that changes is the TimeZone abbreviation, it doesn’t adjust the time to the timezone that was set in config.toml. So, 2021-08-15T09:40:35 appears as:
2021-08-15 09:40:35 PST (n.b. Philippine Standard Time)
2021-08-15 09:40:35 JST – it should be 10:40:35 JST
2021-08-15 09:40:35 KST – it should be 10:40:35 KST
If the new timeZone feature was meant for display only, is there a way to add, in this case, +1 automatically? This way I don’t have to double-check the date value in each post if it was adjusted accordingly?
My current setup is to manually adjust the time in each post.md without the hardcoded timezone so the language timezone setting will show the timezone abbreviation. If I don’t change the time in each post.md for each language, it will show as-is without the timezone adjustment (say +1 hour) while displaying the timezone abbreviation. (see example in original post)
It looks like this isn’t possible with only formatting, even in straight Go. In Go it looks like to change timezone, other than for Local and UTC, you need time.GetLocation(). I guess this would need to be a feature request and/or PR to Hugo. Based on
That is at midnight in time zone “Europe/Oslo” with offset +2, which is when I want my article published. That has been one very common issue with Hugo where the build server (e.g. Netlify, UTC) is many hours ahead/behind the author’s location.
By setting a time zone in config you’re telling Hugo that all dates without any time zone/offset info is in this time zone.
So, not only for display, but also isn’t meant for what @techmagus is trying to do (if I understand the magus’ goal correctly), which is to display a time as the time in a particular timezone, depending on the language of the post. (That is to translate a post in EST to say JST or KST depending on language). Is that correct?
If there is a way to do that, I’d be interested so that I could have my Netlify posts in my timezone instead of Netlify’s (even when the original post already has a timezone), since .Local gives Netlify’s time and UTC isnt’ what I want.