I recently had some comments made on one of my hexo theme, saying the dates don’t generate properly. It turned out the timezone was not set properly.

If you are getting an error similar to:

1
2
3
4
5
INFO Start processing
ERROR Process failed: _posts/postname.md
TypeError: Cannot read property 'offset' of null
at Object.exports.timezone (/home/user/project/node_modules/hexo/lib/plugins/processor/common.js:44:40)
at /home/user/project/node_modules/hexo/lib/plugins/processor/post.js:83:42

it means that your timezone is not set properly.

Timezone values

In the background, Hexo uses MomentJS to compute the dates. You need to use MomentJS Timezone values.

Something like:

  • timezone: Europe/London
  • timezone: America/Thule

The full list of values is available here.