Skip to content

设置上海时区后,0:00-8:00的文章仍然显示为前一天发表 #181

Closed

Description

@cafe3310

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

  1. iissnan commented on May 25, 2015

    @iissnan
    Owner

    Thanks. @tgmerge

    原本使用 Swig 的 date filter 没有传递任何 Timezone 的信息导致的。将替换成 Hexo 的 date helper。

  2. added this to the milestone on May 27, 2015
  3. added a commit that references this issue on Jan 4, 2019
    5dfe82c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions