Explorar el Código

默认时间段修改

zhangchen hace 2 meses
padre
commit
80a1241d66
Se han modificado 1 ficheros con 2 adiciones y 4 borrados
  1. 2 4
      src/views/businessData/overview.vue

+ 2 - 4
src/views/businessData/overview.vue

@@ -228,13 +228,11 @@ function setService(d: ServiceQualityData | undefined) {
 
 const toDateString = (d: Date) => d.toISOString().slice(0, 10);
 
-/** 默认日期区间:本周一到当天 */
+/** 默认日期区间:共 7 天(当天 -6 天到当天,含当天) */
 function initDateRange() {
   const end = new Date();
   const start = new Date(end);
-  const day = start.getDay();
-  const daysToMonday = day === 0 ? 6 : day - 1;
-  start.setDate(start.getDate() - daysToMonday);
+  start.setDate(start.getDate() - 6);
   start.setHours(0, 0, 0, 0);
   dateRange.value = [toDateString(start), toDateString(end)];
 }