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

URL Date Bug #7655

Closed
benheb opened this Issue Nov 1, 2016 · 17 comments

Comments

Projects
None yet
3 participants
@benheb

benheb commented Nov 1, 2016

There seems to be a bug with dates and date urls. A bit funky to explain, but here's an attempt.

Yesterday I published a blog post at 7pm MDT. The url at that point looked like: /2016/10/30/winter-2016-2017-reason-for-concern/, as expected.

Today I went to the blog post and it had changed to /2016/10/31/winter-2016-2017-reason-for-concern/. You'll note it's October 31 now, instead of October 30, as expected.

I checked the timezone for our ghost setup and it's set to Mountain Time, as expected. When I go back to the published post in the admin content, the settings show the correct date/time:

editor_-_weather5280_

It seems to only happen with posts that are published late in the day? Maybe some weird UTC conversion somewhere? Changing the time and re-saving typically will correct the url.

Not really sure where to look. I'm running version 0.11.2.

@kirrg001 kirrg001 self-assigned this Nov 1, 2016

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

Hey @benheb Sorry to hear you are having trouble. I would like to ask you to confirm what i understood from your issue:

You published your post on day 1 and the path was /2016-10-30/winter....
You visited your post on day 2 and the path changed to /2016-10-31/winter....
You did not change your blog timezone between day 1 and day 2.

@benheb

This comment has been minimized.

benheb commented Nov 1, 2016

@kirrg001 correct. I made no changes to the timezone or the post between day 1 and 2.

When I checked the settings on the post on day two, the date was still correct (see screenshot), but the url had changed from 30 to 31.

I then changed the publish time to 15:00 (instead of 19:00), saved the post, and the url was correct. The URL date change seemed to happen auto-magically overnight. I've seen this happen several times recently, dating back a release or two.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

Ok thanks will look into this closer 👍

@benheb

This comment has been minimized.

benheb commented Nov 1, 2016

Thanks @kirrg001! I'll also maybe try setting the time earlier in the day with the next post I publish and see if I still see it? Haven't paid close enough attention, but seems to have only happened with posts I publish later in the evening on Sundays. /shrug

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

@benheb
I was not able to reproduce this issue. Hmm I looked at the affected code section, which calculates the path with the date permalink, but i cannot see an obvious bug.

Could you swing by our slack channel and write me a direct message?
Leaving this issue open until it's clear if it's a bug.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

We found the reason for this issue. Thanks for your help @benheb .
https://github.com/TryGhost/Ghost/blob/lts/core/server/config/url.js#L107 is reading the active timezone from the config. The active timezone was correct in the database, but somehow was not correctly updated in the config ghostConfig.theme.timezone. After just re-saving the timezone from Ghost-Admin it worked. I will look some minutes if i can find something obvious how this can happen.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

@benheb one last question. Did you ever change your timezone via Ghost-Admin (except of today)? Because i remember that we are setting the timezone automatically to your server timezone.

@benheb

This comment has been minimized.

benheb commented Nov 1, 2016

@kirrg001 Good question. I'm not sure, but good chance I never did. I suspect I went and looked and saw that Mountain was selected so never touched it / saved it when I first set things up.

What I did today was 1. Selected the drop down and re-clicked on Mountain, then 2. clicked saved in upper right, and all was good again.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Nov 1, 2016

@benheb Thanks! I am still not able to reproduce. The settings and config cache get's updated for me. So it's unknown why your config value was not updated after updating to a newer Ghost version. I assume the value of the timezone config was still Etc/Utc for your case.

As we found an easy workaround for you and i am not able to reproduce this, I would like to close this issue for now. If more people report a similar issue, i will investigate furthermore. Thanks for your fast support.

@kirrg001 kirrg001 closed this Nov 1, 2016

@benheb

This comment has been minimized.

benheb commented Nov 1, 2016

Thank you @kirrg001

@benheb

This comment has been minimized.

benheb commented Dec 10, 2016

@kirrg001 just FYI, I am able to reproduce these days. Basically every time I restart the ghost server this happens.

  1. Restart node server
  2. Go to published post and see that url is wrong (7 hours ahead) if published late in day
  3. Check settings, confirm that drop down is set to Mountain time (as expected)
  4. Press save on that page and and all timezone issues are resolved

Maybe just me, but happens reliably.

@benheb

This comment has been minimized.

benheb commented Jan 10, 2017

Anyone else see this? @kirrg001 Can we reopen and address?

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Jan 10, 2017

@benheb Hey! Sorry for late response. I will re-open the issue 👍

If somebody is interested in reproducing and fixing this issue, this would be very welcome!

@acburdine

This comment has been minimized.

Member

acburdine commented Jan 20, 2017

Note: #7858 also has a case of this, along with data for reproduction.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Feb 8, 2017

I was able to reproduce - fix is coming 👍

@kirrg001 kirrg001 self-assigned this Feb 8, 2017

@kirrg001 kirrg001 removed the admin-client label Feb 8, 2017

kirrg001 added a commit to kirrg001/Ghost that referenced this issue Feb 8, 2017

🐛 fix date helper bug
closes TryGhost#7655

- caused by a wrong config usage
- whenever you call config.set({key: value}) the timezone was overridden to the default Etc/UTC

kevinansfield added a commit that referenced this issue Feb 8, 2017

🐛 fix date helper bug (#7960)
closes #7655
- caused by a wrong config usage
- whenever you call config.set({key: value}) the timezone was overridden to the default Etc/UTC
@benheb

This comment has been minimized.

benheb commented Feb 8, 2017

Awesommeeee!! 🎉

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Feb 8, 2017

closed via #7960 - will be released in 0.11.5 🙃

@kirrg001 kirrg001 closed this Feb 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment