修改问题

This commit is contained in:
guanj
2026-01-23 15:46:43 +08:00
parent 82f8c366c9
commit b71200cb97
6 changed files with 838 additions and 822 deletions

View File

@@ -113,6 +113,21 @@ function getToday() {
const day = String(today.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 获取当天日期 往前推30天
function getBeforeDays(days = 30) {
const today = new Date();
// 计算往前推N天的时间戳1天=86400000毫秒
const beforeDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000);
return formatDate(beforeDate);
}
function formatDate(date) {
const year = date.getFullYear();
// 月份从0开始补零到2位
const month = String(date.getMonth() + 1).padStart(2, '0');
// 日期补零到2位
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 获取3个月前的日期
function getThreeMonthsAgo() {
@@ -317,5 +332,6 @@ export default {
refreshPrePage,
getDictData,
getToday,
getBeforeDays,
getThreeMonthsAgo
}