Hugo Timezone Shenanigans
A little over a week ago I have unknowingly fallen a victim to timezone handling in Hugo. My previous post did not get published and I did not notice until a few days later.
As it turns out, if a date of a post does not include a timezone Hugo assumes
it is UTC. Additionally, if an exact hour is not provided 00:00:00 is used.
Therefore, 2021-05-16
is interpreted as 2021-05-16 00:00:00 +0000
. This
means that any post I write in my local UTC+2 timezone is considered by Hugo to
be written 2 hours earlier than my local time suggests.
All of this lead to my post written past midnight local time to be considered a post from the next day from UTC perspective. Therefore, the post did not get published as Hugo determined that post’s date is in the future…
There is a GitHub’s issue created on Feb 20, 2016 regarding this matter. With this behaviour most likely not changing any time soon I suppose I will use more detailed date format.