Skip to content

Commit 6ff1b68

Browse files
author
spark
committed
fix:修复 GitHub 时间转换错误
- 移除了 getTimezoneOffset() * 60 * 1000 的计算 -现在直接使用 utcDate.getTime() 获取时间戳
1 parent a6547db commit 6ff1b68

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

frontend/src/components/stock.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@ EventsOn("updateVersion",async (msg) => {
163163
const githubTimeStr = msg.published_at;
164164
// 创建一个 Date 对象
165165
const utcDate = new Date(githubTimeStr);
166-
167166
// 获取本地时间
168-
const date = new Date(utcDate.getTime() + utcDate.getTimezoneOffset() * 60 * 1000);
169-
167+
const date = new Date(utcDate.getTime());
170168
const year = date.getFullYear();
171169
// getMonth 返回值是 0 - 11,所以要加 1
172170
const month = String(date.getMonth() + 1).padStart(2, '0');

0 commit comments

Comments
 (0)