Date shifted by timezone when using `date_from_meta`
squidfunk opened this issue ยท 5 comments
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.
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?
An option would definitely be awesome, ideally defaulting to UTC ๐
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.
I've finally came around testing the newest version and can confirm that the problem I reported is fixed!