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

Date shifted by timezone when using date_from_meta #133

Closed
squidfunk opened this issue Sep 11, 2022 · 5 comments · Fixed by #142
Closed

Date shifted by timezone when using date_from_meta #133

squidfunk opened this issue Sep 11, 2022 · 5 comments · Fixed by #142
Assignees
Labels
enhancement New feature or request

Comments

@squidfunk
Copy link

First of all, great plugin! Material for MkDocs will get blog support tomorrow, and I'm finishing up the last small little details to make it awesome. Your plugin will be advertised on the documentation for adding RSS support, as it's the best one out there.

I've encountered a problem where the dates of blog articles are not correctly computed when date_from_meta is used. my configuration in mkdocs.yml is as follows:

plugins:
  - rss:
      match_path: blog/posts/.*
      date_from_meta:
        as_creation: date
      categories:
        - categories
        - tags

When I set a date in a blog article, the computed time is shifted by the UTC offset of the current timezone. For example:

---
date: 2022-05-05
---

Becomes:

<pubDate>Wed, 04 May 2022 22:00:00 -0000</pubDate>

IMHO, dates should be treated as UTC. I'm currently in UTC+2, so this seems to be the problem.

@Guts Guts self-assigned this Sep 11, 2022
@Guts
Copy link
Owner

Guts commented Sep 11, 2022

Hello @squidfunk,

Thanks for your interest and your kind comment.

You're right, by default, datetimes should be treated in UTC. I've never figured it out because I'm used to deploy Mkdocs websites with CI/CD (GitHub or GitLab).

What about an option to specify the default timezone to use?

@squidfunk
Copy link
Author

An option would definitely be awesome, ideally defaulting to UTC 😊

@Guts
Copy link
Owner

Guts commented Oct 4, 2022

Hi @squidfunk,

I'm working on the feature in #142. For now it's only compatible with Python 3.9+. Feel free to test if you can/want, feedback are welcome.

Thanks for you patience.

@Guts Guts added the enhancement New feature or request label Oct 4, 2022
@Guts Guts closed this as completed in #142 Oct 7, 2022
@Guts
Copy link
Owner

Guts commented Oct 7, 2022

@squidfunk
Copy link
Author

squidfunk commented Oct 9, 2022

I've finally came around testing the newest version and can confirm that the problem I reported is fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants