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

timezone的配置问题 #2063

Open
mamboer opened this issue Jul 27, 2016 · 10 comments
Open

timezone的配置问题 #2063

mamboer opened this issue Jul 27, 2016 · 10 comments

Comments

@mamboer
Copy link

mamboer commented Jul 27, 2016

对于发布日期小时为0时的文章,本机编译和travis上编译出来的日期相差一天,在配置文件中指定了timezone依然有次问题。

Environment Info

Node version(node -v)

v5.12.0

_config.yml

timezone: Asia/Shanghai
...

日期设置示例,注意其中date的配置中小时为00

title: 手把手教你搭建ngrok服务-轻松外网调试本机站点
subtitle: "ngrok的核心功能:能够将你本机的HTTP服务(站点)或TCP服务,通过部署有ngrok服务的外网伺服器暴露给外网访问!"
cover: //img.aotu.io/mamboer/ngrok.jpg
date: 2016-02-19 00:55:35
categories: Web开发
tags:
  - ngrok
  - 反向代理
  - 调试

如上配置示例,当date2016-02-19 00:55:35时,在本地编译出来的文章路径为/2016/02/19,但是在travis上面变成了/2016/02/18

@zhaohongxuan
Copy link

我的把_config目录中的timezone配置去掉了就没问题了

@NoahDragon NoahDragon added the question Needs help in usage label Mar 27, 2017
@sayll
Copy link

sayll commented May 4, 2017

现在我也只能通过timezone留空的办法了。

@NoahDragon
Copy link
Member

请问使用的是哪个主题呢?

@sayll
Copy link

sayll commented May 4, 2017

@NoahDragon
Copy link
Member

NoahDragon commented May 4, 2017

@sayll
Copy link

sayll commented May 4, 2017

@NoahDragon 我能为此做些什么?

@NoahDragon
Copy link
Member

@sayll 从以上那段代码可以看出,front matter中的Date被认为是UTC时间。所以要使timezone运行正常,需要在Date中写入当前的UTC时间。这些都是从上面代码片段解读而来,等有时间我验证一下。

@sayll
Copy link

sayll commented May 4, 2017

@NoahDragon 嗯嗯,在此多谢。

@stale stale bot added the wontfix This will not be worked on label Sep 27, 2017
@hexojs hexojs deleted a comment from stale bot Sep 27, 2017
@NoahDragon NoahDragon added need-verify and removed wontfix This will not be worked on labels Sep 27, 2017
@seamlik
Copy link

seamlik commented Apr 14, 2018

I don't know if this solves the issue, but I always specify the timezone in the date of my posts. For example: 2018-04-14T13:00:38+08:00. This is the standard representation of combining date, time and timezone.

I propose that Hexo should always append the timezone in the generated date. This way it might be more flexible when the site is configured to display local time to visitors.

@curbengh curbengh removed the question Needs help in usage label Dec 9, 2019
@stevenjoezhang
Copy link
Member

See also #3397 #2705

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

7 participants