Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tgmerge opened this issue May 23, 2015 · 1 comment
Closed

Comments

@tgmerge
Copy link

tgmerge commented May 23, 2015

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没有深究原因。

@iissnan
Copy link
Owner

iissnan commented May 25, 2015

Thanks. @tgmerge

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

@iissnan iissnan added this to the v0.4.1 milestone May 27, 2015
@iissnan iissnan closed this as completed Jun 12, 2015
yzbyzz pushed a commit to yzbyzz/hexo-theme-next that referenced this issue Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants