chore: use UTF+8 time to build

This commit is contained in:
wonfen
2025-09-05 11:21:34 +08:00
Unverified
parent f38e4a6cac
commit feb3dfbe86
5 changed files with 19 additions and 9 deletions

View File

@@ -68,14 +68,24 @@ function getLatestTauriCommit() {
}
/**
* 生成短时间戳(格式:YYMMDD或带 commit格式YYMMDD.cc39b27
* 生成短时间戳格式MMDD或带 commit格式MMDD.cc39b27
* 使用 Asia/Shanghai 时区
* @param {boolean} withCommit 是否带 commit
* @returns {string}
*/
function generateShortTimestamp(withCommit = false) {
const now = new Date();
const month = String(now.getMonth() + 1).padStart(2, "0");
const day = String(now.getDate()).padStart(2, "0");
const formatter = new Intl.DateTimeFormat('en-CA', {
timeZone: 'Asia/Shanghai',
month: '2-digit',
day: '2-digit'
});
const parts = formatter.formatToParts(now);
const month = parts.find(part => part.type === 'month').value;
const day = parts.find(part => part.type === 'day').value;
if (withCommit) {
const gitShort = getGitShortCommit();
return `${month}${day}.${gitShort}`;

View File

@@ -75,7 +75,7 @@ async function sendTelegramNotification() {
const releaseTitle = isAutobuild ? "滚动更新版发布" : "正式发布";
const encodedVersion = encodeURIComponent(version);
const content = `<b>🎉 <a href="https://github.com/clash-verge-rev/clash-verge-rev/releases/tag/v${encodedVersion}">Clash Verge Rev v${version}</a> ${releaseTitle}</b>\n\n${formattedContent}`;
const content = `<b>🎉 <a href="https://github.com/clash-verge-rev/clash-verge-rev/releases/tag/autobuild">Clash Verge Rev v${version}</a> ${releaseTitle}</b>\n\n${formattedContent}`;
// 发送到 Telegram
try {