Open tcrowe opened 5 years ago
Was just about to post an issue regarding this, glad to see it's probably because of my timezone (Pacific/Auckland).
A post made on the 19th of November is showing the post.date being 4th of November, all other dates are off too, although most are just off by one.
Here's a link to my repo - https://github.com/puremana/personal-blog Affected post - https://github.com/puremana/personal-blog/blob/master/source/_posts/CORS-And-Hiding-Api-Keys.md
@puremana Thank you for adding your experience with this as I am investigating the dates and timezones!
I'm not yet investigate, but #3282 is possibility that same problem.
Thank you, @YoshinoriN. I will search for all the places with timezone and see what else it's used for. Then I will make a PR to fix it. It's actually been there since the beginning. lol
I tried for a while but I did not come to a solution. I will try again tomorrow.
@tcrowe any luck?
No, @puremana. For now all we can do is ask people to disable(comment or delete) the timezone:
configuration which will render the dates in the timezone of the machine generating the output source.
When I was looking at the code I couldn't figure out the original intention so I need to think about the implications.
Was it true that if you disable the timezone:
that the dates show up as you expect?
Sorry, it turns out timezone doesn't change anything at all in my project, even when it should be. My bug was something else, thanks for all of your help
In this issue we found that if the user sets
timezone:
in their_config.yml
the date is modified and can be different than what they expect. https://github.com/hexojs/hexo/issues/3365See this code here: https://github.com/hexojs/hexo/blame/master/lib/plugins/processor/post.js#L78
https://github.com/hexojs/hexo/blame/90b107c8b0bd8b386f64463403391f67eb1b2535/lib/plugins/processor/post.ts#L123
if timezone then change date
I'm not certain if this is a bug or not so I need help to understand.
How to test
1.
View markdown dates and then view post dates in browser
Set
timezone: Asia/Shanghai
inside./_config.yml
hexo clean && hexo serve
Repeat 2
If you do that you should notice the same date changes reported in #3365. Is this a bug or should hexo be changing the date relative to GMT or location?
Thanks for taking a look