Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue: Preview urls generated using local time zone rather than UTC #887

Closed
nyergler opened this issue Nov 11, 2024 · 4 comments
Closed
Labels
bug Something isn't working In BETA The current task is available for testing in the BETA version. Released The task has been released v10.7.0 Project: v10.7.0

Comments

@nyergler
Copy link

nyergler commented Nov 11, 2024

I'm using Front Matter with a Hugo blog. My permalinks include the post date, and I have the following in my FM configuration:

  "frontMatter.preview.pathName": "{{date|yyyy/MM/DD}}/",

When I try to open the preview in the editor ("Front Matter: Preview content"), the URL opened is generated using the local timezone (UTC-8 for me), rather than UTC. This causes problems when the date in UTC does not match the date in my time zone.

For example, a post with the following front-matter:

date: 2017-07-06T04:03:44.000Z
slug: foo

Will be generated by Hugo at /2017/07/06/foo; however FM will open /2017/07/05/foo when I try to preview the content.

I'm not sure this is really a bug; it's more of an inconsistency between the framework and FM. I'm wondering if there's a way to configure the timezone for FM that I haven't found.

Thanks for FM; it's really cool!

@nyergler nyergler added the bug Something isn't working label Nov 11, 2024
@estruyf
Copy link
Owner

estruyf commented Nov 13, 2024

Thanks, @nyergler, for opening this issue. I'll see what I can do to resolve it.

@estruyf
Copy link
Owner

estruyf commented Nov 14, 2024

@nyergler I have included a new setting + change to the formatting logic. With the new frontMatter.global.timezone setting, you can define the timezone in which you want to format the dates.

The default is set to utc. In your case, it should now process the date as UTC and not in your timezone.

Can you verify this in the latest beta version?

@estruyf estruyf added this to v10.8.0 Nov 14, 2024
@estruyf estruyf moved this to To document in v10.8.0 Nov 14, 2024
@project-labels project-labels bot added v10.7.0 Project: v10.7.0 To document This item needs to be documented labels Nov 14, 2024
@nyergler
Copy link
Author

Thanks, @estruyf, that seems to work as expected in the beta version!

@estruyf
Copy link
Owner

estruyf commented Dec 30, 2024

Thank you for verifying @nyergler 🙏

@estruyf estruyf moved this from To document to In beta in v10.8.0 Dec 31, 2024
@project-labels project-labels bot added In BETA The current task is available for testing in the BETA version. and removed To document This item needs to be documented labels Dec 31, 2024
@estruyf estruyf moved this from In beta to Released in v10.8.0 Jan 2, 2025
@project-labels project-labels bot added the Released The task has been released label Jan 2, 2025
@estruyf estruyf closed this as completed Jan 2, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working In BETA The current task is available for testing in the BETA version. Released The task has been released v10.7.0 Project: v10.7.0
Projects
None yet
Development

No branches or pull requests

2 participants