Update generate_notification_report.js

This commit is contained in:
Vaica authored and GitHub committed 2026-03-01 20:29:23 +08:00
1 parent 1d6ac36a0c
commit 118010520c
1 file changed
+8 -6
+8 -6
View File
@@ -9,11 +9,13 @@ const POSTS_DIR = path.join(__dirname, '../content/post');
const BASE_URL = "https://usj.cc";
// Helper to format date as YYYYMMDD
function formatDateYYYYMMDD(date) {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, '0');
const d = String(date.getDate()).padStart(2, '0');
return `${y}${m}${d}`;
function formatDateYYYYMMDDHHmm(date) {
const y = date.getFullYear(); // 获取年份(4位)
const m = String(date.getMonth() + 1).padStart(2, '0'); // 月份(补零到2位,注意月份从0开始)
const d = String(date.getDate()).padStart(2, '0'); // 日期(补零到2位)
const h = String(date.getHours()).padStart(2, '0'); // 小时(24小时制,补零到2位)
const mm = String(date.getMinutes()).padStart(2, '0'); // 分钟(补零到2位)
return `${y}${m}${d}${h}${mm}`;
}
// Helper to get latest post from content/post
@@ -46,7 +48,7 @@ function getLatestPost() {
title: parsed.data.title || file.replace('.md', ''),
date: date,
// Construct URL based on hugo.toml: /:year:month:day.html
url: `${BASE_URL}/${formatDateYYYYMMDD(date)}.html`
url: `${BASE_URL}/${formatDateYYYYMMDDHHmm(date)}.html`
};
}
}