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.Format - timezone details missing with time_full and time_long with TOML dates #8895

Closed
jmooring opened this issue Aug 16, 2021 · 5 comments · Fixed by #9082
Closed
Assignees
Labels
Milestone

Comments

@jmooring
Copy link
Member

This issue title is... terrible.

content/tests/pass.md

+++
title = "Pass"
date = "2021-08-16T06:00:00-07:00"  # String
draft = false
+++

content/tests/fail.md

+++
title = "Fail"
date = 2021-08-16T06:00:00-07:00    # Date
draft = false
+++
pass.md fail.md
{{ .Date | time.Format ":time_full" }} 6:00:00 am Pacific Daylight Time 6:00:00 am
{{ .Date | time.Format ":time_long" }} 6:00:00 am PDT 6:00:00 am
@bep
Copy link
Member

bep commented Aug 16, 2021

I suspect this is a duplicate of #8891

@jmooring
Copy link
Member Author

hugo v0.88.0-DEV-EFEBD756+extended linux/amd64 BuildDate=2021-08-16T10:10:04-0700

Includes fix for #8891.

@bep bep added the Bug label Aug 16, 2021
@bep bep added this to the v0.88 milestone Aug 16, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
satotake added a commit to satotake/hugo that referenced this issue Oct 25, 2021
`go-toml/v2`'s unmarshaler does not specify zone name even if value has
offset explicitly.
To make time-formatting behaviour consistent, convert them into string
in hugo.

Close gohugoio#8895
@satotake
Copy link
Contributor

Confirmed with hugo v0.88.1+extended darwin/amd64 BuildDate=unknown

md type in toml parsed by zone name
pass.md String cast PDT
fail.md Datetime go-toml ""

We could regard this as an upstream issue while I guess that go-toml sets an empty timezone name intensionally.
An easy fix may be #9082 .

@bep bep closed this as completed in #9082 Oct 25, 2021
bep pushed a commit that referenced this issue Oct 25, 2021
`go-toml/v2`'s unmarshaler does not specify zone name even if value has
offset explicitly.
To make time-formatting behaviour consistent, convert them into string
in hugo.

Close #8895
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2022
@bep bep modified the milestones: v0.89, v0.100.2 Jun 6, 2022
@bep bep self-assigned this Jun 6, 2022
@bep bep reopened this Jun 6, 2022
@bep
Copy link
Member

bep commented Jun 6, 2022

I'm reopening this as I tried to add the above as a test case, but it fails.

I have removed the patch that was supposed to fix this, as I didn't understand it and it came without a test case.

Note that I'm not sure this should/could be fixed:

  • go-toml parses offset dates on RFC 3339 format, with empty zone name (expect for UTC, oddly enough)
  • The way Hugo parses RFC 3339 is a little differently, but in my tests I get all empty zone name in this case, too. I suspect that this may be computer dependant.

@bep bep closed this as completed Jun 16, 2022
@bep bep modified the milestones: v0.100.2, v0.101.0 Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants