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

Most upvoted comments

@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?