时间的切换

This commit is contained in:
lq
2025-08-29 16:39:14 +08:00
parent c082aa926c
commit 37ac8662ec
2 changed files with 98 additions and 57 deletions

View File

@ -33,6 +33,14 @@ class DateUtils {
};
}
static MonthStrToDate(dateStr: string): Date {
const year = parseInt(dateStr.split('年')[0]);
const month = parseInt(dateStr.split('年')[1].split('月')[0]) - 1; // 月份从0开始
const date = new Date(year, month, 1);
return date;
}
/**
* 获取指定年份和月的范围
* @param year 年份