jekyll: Missing timezone in metadata date can lead to wrong date in url
Starting with a fresh new Jekyll site with no modifications, I noticed that the first auto-generated post got the wrong page date when served. It looks like a missing timezone in the posts metadata can lead to the generated url being one day off when the time is close enough to midnight.
Metadata of file /_posts/2013-05-09/welcome-to-jekyll.markdown
:
---
layout: post
title: "Welcome to Jekyll!"
date: 2013-05-09 22:39:53
categories: jekyll update
---
This leads to the post having url /jekyll/update/2013/05/10/welcome-to-jekyll.html
, which can be explained by me being in a timezone with offset +0200.
The url I expected to see was /jekyll/update/2013/05/09/welcome-to-jekyll.html
.
Changing or removing the time part of the metadata (or adding timezone info) fixes the problem as expected, but it left me puzzled for a moment.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 36 (16 by maintainers)
Commits related to this issue
- change dates / timezone info. see https://github.com/jekyll/jekyll/issues/1069 — committed to dnozay/dnozay.github.io by dnozay 10 years ago
- Add date to first post Also noticed that Jekyll has some issues with timezones. cf https://github.com/jekyll/jekyll/issues/1069 — committed to davep/davep.github.com by davep 9 years ago
- Remove timezone from welcome post Setting the _config timezone didn't solve the issue. Maybe I should add timezone to all dates in all posts, but I'm going to try this first. I'm not concerned about ... — committed to e28eta/e28eta.github.io by e28eta 7 years ago
- attempt to fix date/time by setting timezone Following https://github.com/jekyll/jekyll/issues/1069 to attempt to fix the incorrect dates — committed to applewoodhoa/applewoodhoa.github.io by cardoe 6 years ago
@parkr I understand how this could cause unexpected results if I’m writing my times assuming UTC +5, and jekyll has a build script that runs when I deploy on a heroku server living in UTC +8, but why ignore the explicit timezone setting in the config file? That seems like a perfectly good way to know what the time should be.
What is the timezone config option used for if not helping jekyll parse dates at build time?