mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
fix:修复 GitHub 时间转换错误
- 移除了 getTimezoneOffset() * 60 * 1000 的计算 -现在直接使用 utcDate.getTime() 获取时间戳
This commit is contained in:
parent
a6547db195
commit
6ff1b68f1b
@ -163,10 +163,8 @@ EventsOn("updateVersion",async (msg) => {
|
||||
const githubTimeStr = msg.published_at;
|
||||
// 创建一个 Date 对象
|
||||
const utcDate = new Date(githubTimeStr);
|
||||
|
||||
// 获取本地时间
|
||||
const date = new Date(utcDate.getTime() + utcDate.getTimezoneOffset() * 60 * 1000);
|
||||
|
||||
const date = new Date(utcDate.getTime());
|
||||
const year = date.getFullYear();
|
||||
// getMonth 返回值是 0 - 11,所以要加 1
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
|
Loading…
x
Reference in New Issue
Block a user