Hexo的`_config.yml`里已经设置了`timezone: Asia/Shanghai`,但发表时间为0:00-8:00的文章,会显示为在前一天发表。比如,文章的front-matter有 ``` date: "2015-05-24 04:50" ``` 在页面里,发表时间就会显示为2015-05-23。 用hexo自带的landscape主题则不会出现这个问题。 --- 试了下,在`layout\_macro\post.swig`: ``` 29 - | {{ __('post.posted') }} {{ post.date | date('Y-m-d') }} 29 + | {{ __('post.posted') }} {{ date(post.date, 'YYYY-MM-DD') }} ``` 似乎就能解决这个问题,不过不熟悉swig没有深究原因。
Activity
iissnan commentedon May 25, 2015
Thanks. @tgmerge
原本使用 Swig 的 date filter 没有传递任何 Timezone 的信息导致的。将替换成 Hexo 的 date helper。
Bug: Date does not apply to corresponding Timezone if using swig date…
Fix iissnan#181 and iissnan#333 (iissnan#534)