diff --git a/scripts/generate_notification_report.js b/scripts/generate_notification_report.js index f6ee8c49..aeb0e905 100644 --- a/scripts/generate_notification_report.js +++ b/scripts/generate_notification_report.js @@ -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` }; } }