Browse Source

日期组件调整

guanyongjie 5 days ago
parent
commit
550d0620ce
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/views/news/components/dialog/oneClickExportReport.vue

+ 8 - 5
src/views/news/components/dialog/oneClickExportReport.vue

@@ -73,12 +73,15 @@ const shortcuts = [
   {
     text: '上周',
     value: () => {
-      const end = new Date();
-      end.setDate(end.getDate() - end.getDay())
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = now.getMonth();
+      const date = now.getDate()
+      const day = now.getDay()
+
+      const start = new Date(year, month, date - day - 6)
+      const end = new Date(year, month, date - day)
       end.setHours(23, 59, 59, 999)
-      const start = new Date(end);  
-      start.setDate(start.getDate() - 7)
-      start.setHours(0, 0, 0, 0)
       return [start,end]
     },
   },