From 961fa94be0787f5a1b77b85c9e447873bfc5b294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=99=8C?= Date: Mon, 15 Jan 2024 00:08:01 +0800 Subject: [PATCH] no message --- src/components/xStat/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);