15 lines
571 B
JavaScript
15 lines
571 B
JavaScript
export default{
|
|
getCurrentMonthStartDates(currentDate) {
|
|
const firstDay = new Date(currentDate);
|
|
firstDay.setDate(1);
|
|
// 格式化日期为YYYY-MM-DD格式
|
|
return firstDay.toISOString().slice(0, 10);
|
|
},
|
|
|
|
getCurrentMonthEndDates(currentDate) {
|
|
const lastDay = new Date(currentDate);
|
|
lastDay.setMonth(lastDay.getMonth() + 1, 0); // 设置日期为下个月的第一天的前一天,即当前月的最后一天
|
|
// 格式化日期为YYYY-MM-DD格式
|
|
return lastDay.toISOString().slice(0, 10);
|
|
}
|
|
} |