Rubenerd

Skip to content
By Ruben Schade in s/Singapore/Sydney/. 🌻

Home About Archives Podcast RSS Omake

Jekyll 1.5.1 likes my timezones again

Saturday 05 April 2014 Software

Promotional artbook image of the K-On! girls for their London movie

At some point in the most recent branch, my Jekyll setup began falling over itself with timezones in timestamps. I hesitated to call it a general bug, given I use Jekyll in a fairly custom way. In any case, this was a serious issue given I’ve written this blog from a dozen different timezones over its nine year history, including a couple that were more than 12 hours apart.

(To be fair, Jekyll still performs far better than WordPress ever did for timezones, particularly when I was living in Singapore and studying in Adelaide, Australia. My late night SQL adventures with that are for another post).

My solution, at the time, was to bypass the bug by moving the offending timezone to its own front matter “tz” attribute. This necessitated adding extra post.tz Liquid markup everywhere where dates were handled, then writing a custom date mask that didn’t convert the time to UTC, but supressing the automatically added timezone. It was a horrible hack, but it worked:

title: "Clara and Ruben's Singapore-KL-Tokyo-Seoul-HK-Taipei trip"
date: "2014-04-05T11:33:10
tz: "+1100"
hash: [goop]

With the most recent 1.5.1 release, I noticed most of my posts were off by a day. It prevented me writing my post yesterday, on account of not wanting to mess up timestamps for thousands of posts.

Fortunately, this failure was for a wondrous reason; Jekyll now recognises my timezones again! A quick regex to remove text and a newline, regenerate my post hashes, and my dates are now properly parsed:

title: "Clara and Ruben's Singapore-KL-Tokyo-Seoul-HK-Taipei trip"
date: "2014-04-05T11:33:10+1100
hash: [different goop]

I’ll be marking my earlier hack post as hysterical historical. Thank you Jekyll team and contributors, you made this guy’s day :”).

K-On! promotional movie artwork © Kyoto Animation 京都アニメーション


Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!


Newer post ← All the better for Wikipedia to see you with
Older post → Digg is back, and spamming us