Automating the posting process on shitpost, I have discovered a bug in Jekyll. If the post timestamp is exactly the same as the system time (correct to the nearest second), and the jekyll process is running with the --watch flag, then the post will be built with an incorrect timestamp, namely midnight on the current date.

Example: Having jekyll build --watch running, run the following:

cat << EOF > _posts/$(date -I)-test.md
---    
layout: post
title: test
date: $(date "+%Y-%m-%d %H:%M:%S %z")
---
test
EOF

Instead of e.g. 2017-09-06 22:10:00 +0800, the timestamp will show 2017-09-06 00:00:00 +0800.

Too lazy to write up a formal bug report, I used a sleep 1 as a workaround in my automation script.