From 60cbc9fe3c34cfc23de82a587032a820968bfa9c Mon Sep 17 00:00:00 2001 From: plainheart Date: Mon, 1 Jan 2024 00:20:14 +0800 Subject: [PATCH] chore(workflow): fix timezone error when getting new year by `new Date` --- .github/workflows/.scripts/update-notice-year.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/.scripts/update-notice-year.js b/.github/workflows/.scripts/update-notice-year.js index 61505ff5a4..2fbb6b7b82 100644 --- a/.github/workflows/.scripts/update-notice-year.js +++ b/.github/workflows/.scripts/update-notice-year.js @@ -7,7 +7,10 @@ module.exports = async function updateNoticeYear( /** @type {{ octokit: Octokit, context: Context }} */ { octokit, context } ) { - const newYear = new Date().getFullYear() + const now = new Date() + // Change to UTC+8 + now.setHours(now.getHours() + 8) + const newYear = now.getFullYear() console.log('Prepare to update notice year to', newYear) const noticeContent = `Apache ECharts