diff --git a/src/components/xStat/index.vue b/src/components/xStat/index.vue index 6f97e3b..08e0e6f 100644 --- a/src/components/xStat/index.vue +++ b/src/components/xStat/index.vue @@ -89,8 +89,9 @@ export default { getMonthDates() { const currentDate = new Date(); const year = currentDate.getFullYear(); + const day = currentDate.getDate(); const month = currentDate.getMonth() + 1; // JavaScript 中的月份是从 0 开始的,所以要加 1 - const startOfMonth = new Date(year, month - 1, 1); + const startOfMonth = new Date(year, month - 2, day); const endOfMonth = new Date(year, month, 0, 23, 59, 59); // 设置为本月最后一天的最后一秒 const startDate = this.formatDate(startOfMonth); const endDate = this.formatDate(endOfMonth);