Przeglądaj źródła

DatePicker: fix marks are displaced when type is range, fixed #2612

qingwei.li 8 lat temu
rodzic
commit
5fc34777b7

+ 1 - 1
build/cooking.demo.js

@@ -118,6 +118,6 @@ if (isProd) {
 cooking.add('plugin.CopyWebpackPlugin', new CopyWebpackPlugin([
   { from: 'examples/versions.json' }
 ]));
-cooking.add('plugin.OfflinePlugin', new OfflinePlugin());
+isProd && cooking.add('plugin.OfflinePlugin', new OfflinePlugin());
 cooking.add('vue.preserveWhitespace', false);
 module.exports = cooking.resolve();

+ 2 - 2
packages/date-picker/src/basic/date-table.vue

@@ -270,7 +270,7 @@
       getDateOfCell(row, column) {
         const startDate = this.startDate;
 
-        return new Date(startDate.getTime() + (row * 7 + (column - (this.showWeekNumber ? 1 : 0))) * DAY_DURATION);
+        return new Date(startDate.getTime() + (row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay) * DAY_DURATION);
       },
 
       getCellByDate(date) {
@@ -322,7 +322,7 @@
 
             const cell = row[j];
             const index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
-            const time = startDate.getTime() + DAY_DURATION * index;
+            const time = startDate.getTime() + DAY_DURATION * (index - this.offsetDay);
 
             cell.inRange = minDate && time >= clearHours(minDate) && time <= clearHours(maxDate);
             cell.start = minDate && time === clearHours(minDate.getTime());