Skip to content
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 Calculations #220

Open
rocketnateynate opened this issue Dec 24, 2021 · 4 comments
Open

Time Calculations #220

rocketnateynate opened this issue Dec 24, 2021 · 4 comments
Labels

Comments

@rocketnateynate
Copy link

Wondering about timezone support for issues now that Hugo officially supports timezone configuration...

https://gohugo.io/getting-started/configuration/#timezone

I have worked around the issue by building my own layouts/issues/* files and calculations seem to work. However when daylight savings time comes around, I must edit the files to reflect that, which also changes past issues to be an hour difference. The same when I switch back.

Are there plans to incorporate some sort of timezone config in the config.yaml, or is there a workaround (config) I can do so I won't have to edit the partials when daylight savings time comes and goes?

** disclaimer, I am a newbie at hugo, but proficient in programming and git

@mistermantas
Copy link
Member

I'm guessing you're talking about time calculations and not time stamps.

in v5 time stamps are calculated relative to UTC, so the the time has to be in UTC as well - so you have to convert your time zone (daylight savings or not) to UTC - #151

It's a little bit confusing but it's a great system if you use something like Netlify CMS where it gets that info immediately

time calculations for issues are calculated relative to each other. (it took 50 minutes for an issue to be resolved, calculating in UTC)

cstate supports time zones and relative time even before hugo v0.87 - am I missing something? can you send your layout file snippets, maybe that'd help me understand?

@rocketnateynate
Copy link
Author

I see what you are saying....

For relative times, the calcs work.

And in my issues, I set the time so if I set them all relative to my timezone, things are good.

However, last modified, and the "32 hours" on the main page (short issues list at bottom) calcs are off unless IO set a partial and use the Hugo date formatting for my timezone, or at least take out the "UTC" out of the code.

Its possible this is all a non-issue and I am missing an option or workaround. Don't want to waste anyones time.

@rocketnateynate
Copy link
Author

I've found that working around the process in the manner I mentioned gets the results that I need for this time. This issue can be closed.

@mistermantas
Copy link
Member

However, last modified, and the "32 hours" on the main page (short issues list at bottom) calcs are off unless IO set a partial and use the Hugo date formatting for my timezone, or at least take out the "UTC" out of the code.

hi again! that's really strange, how were they calculated wrong in the default templates and what did you change the templates to? sharing the code would be useful here

since hugo started supporting time zones in the newer versions which i wasn't aware of, it would be logical for me to document the 'proper' settings - currently I have designed the system for all dates to be in UTC (and show in UTC, if you disable relative time) so that they can be calculated regardless of what region you are in

@mistermantas mistermantas reopened this Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants