Why is there no update this year? The environment is GitHub pages. It was regenerated after resubmitting the commit, and there was no change.

Time zone.

Shouldn’t it be placed at the lower level of language?

The timeZone configuration value is relevant when using the time.AsTime function.

The time.Now function returns local time.

When GitHub pages builds your site, their local time is Etc/UTC.

You need to set the TZ environment variable in your GitHub Pages workflow file. For example:

TZ: Asia/Shanghai

Great, in this case, can a multi-language site be configured with multiple time zones?

No and yes…

No, you can’t set language-specific environment variables in your GitHub Pages workflow.

Yes, you can set the timeZone configuration value per language, and then use time.AsTime when working with the local time returned by time.Now. For example:

{{ time.AsTime (now.Format "2006-01-02") }}

This discussion is also relevant

And some of that discussion is just… wrong.

I also had to add the timezone environment variable in CF pages for the current year to show, since I thought now.Year works out of the box. So, I am curious what’s wrong in that discussion?

{{ $loc := time.LoadLocation "Europe/Berlin" }}
{{ dateFormat "January 2, 2006 3:04 PM" (.Date.In $loc) }}

time.LoadLocation isn’t a thing.

Alternatively you can set a global timezone in the site configuration

The timeZone configuration value is irrelevant for fully qualified dates.

Like mentioned above: setting the timezone hugo wide to any valid value you like, should have fixed the issue as well.

No. See previous comment.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.