Update generate_notification_report.js
This commit is contained in:
1 parent
306c0f49bd
commit
6bbd6f6c1f
1 file changed
+8
-6
@@ -9,11 +9,13 @@ const POSTS_DIR = path.join(__dirname, '../content/post');
|
|||||||
const BASE_URL = "https://usj.cc";
|
const BASE_URL = "https://usj.cc";
|
||||||
|
|
||||||
// Helper to format date as YYYYMMDD
|
// Helper to format date as YYYYMMDD
|
||||||
function formatDateYYYYMMDD(date) {
|
function formatDateYYYYMMDDHHmm(date) {
|
||||||
const y = date.getFullYear();
|
const y = date.getFullYear(); // 获取年份(4位)
|
||||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
const m = String(date.getMonth() + 1).padStart(2, '0'); // 月份(补零到2位,注意月份从0开始)
|
||||||
const d = String(date.getDate()).padStart(2, '0');
|
const d = String(date.getDate()).padStart(2, '0'); // 日期(补零到2位)
|
||||||
return `${y}${m}${d}`;
|
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
|
// Helper to get latest post from content/post
|
||||||
@@ -46,7 +48,7 @@ function getLatestPost() {
|
|||||||
title: parsed.data.title || file.replace('.md', ''),
|
title: parsed.data.title || file.replace('.md', ''),
|
||||||
date: date,
|
date: date,
|
||||||
// Construct URL based on hugo.toml: /:year:month:day.html
|
// Construct URL based on hugo.toml: /:year:month:day.html
|
||||||
url: `${BASE_URL}/${formatDateYYYYMMDD(date)}.html`
|
url: `${BASE_URL}/${formatDateYYYYMMDDHHmm(date)}.html`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user