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

Possible dates bug lib/plugins/processor/post.js #3397

Open
tcrowe opened this issue Dec 21, 2018 · 8 comments
Open

Possible dates bug lib/plugins/processor/post.js #3397

tcrowe opened this issue Dec 21, 2018 · 8 comments
Labels

Comments

@tcrowe
Copy link
Contributor

tcrowe commented Dec 21, 2018

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.
#3365

See 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

hexo init
npm install
hexo new post one
hexo new post two
hexo new post three
hexo serve
  1. View markdown dates and then view post dates in browser

  2. Set timezone: Asia/Shanghai inside ./_config.yml

  3. hexo clean && hexo serve

  4. 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

@puremana
Copy link

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

@tcrowe
Copy link
Contributor Author

tcrowe commented Dec 22, 2018

@puremana Thank you for adding your experience with this as I am investigating the dates and timezones!

@yoshinorin
Copy link
Member

I'm not yet investigate, but #3282 is possibility that same problem.

@tcrowe
Copy link
Contributor Author

tcrowe commented Dec 28, 2018

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

@tcrowe
Copy link
Contributor Author

tcrowe commented Dec 28, 2018

I tried for a while but I did not come to a solution. I will try again tomorrow.

@puremana
Copy link

puremana commented Jan 3, 2019

@tcrowe any luck?

@tcrowe
Copy link
Contributor Author

tcrowe commented Jan 4, 2019

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?

@puremana
Copy link

puremana commented Jan 4, 2019

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

michaelsbradleyjr added a commit to embarklabs/embark that referenced this issue Aug 20, 2019
See: hexojs/hexo#3397

We will need to use a redirect plugin and supply aliases for already published
posts: https://github.com/hexojs/hexo-generator-alias
michaelsbradleyjr added a commit to embarklabs/embark that referenced this issue Aug 26, 2019
See: hexojs/hexo#3397

We will need to use a redirect plugin and supply aliases for already published
posts: https://github.com/hexojs/hexo-generator-alias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants