Browse Source

pass test
find other bug and fixed it-

Diamond 8 years ago
parent
commit
1b8657ce0d

+ 3 - 13
packages/date-picker/src/basic/time-spinner.vue

@@ -80,22 +80,11 @@
     },
 
     watch: {
-      hours(newVal) {
-        this.ajustElTop('hour', newVal);
-      },
-
-      minutes(newVal) {
-        this.ajustElTop('minute', newVal);
-      },
-
-      seconds(newVal) {
-        this.ajustElTop('second', newVal);
-      },
-
       hoursPrivate(newVal, oldVal) {
         if (!(newVal >= 0 && newVal <= 23)) {
           this.hoursPrivate = oldVal;
         }
+        this.ajustElTop('hour', newVal);
         this.$emit('change', { hours: newVal });
       },
 
@@ -103,6 +92,7 @@
         if (!(newVal >= 0 && newVal <= 59)) {
           this.minutesPrivate = oldVal;
         }
+        this.ajustElTop('minute', newVal);
         this.$emit('change', { minutes: newVal });
       },
 
@@ -110,7 +100,7 @@
         if (!(newVal >= 0 && newVal <= 59)) {
           this.secondsPrivate = oldVal;
         }
-
+        this.ajustElTop('second', newVal);
         this.$emit('change', { seconds: newVal });
       }
     },

+ 3 - 0
packages/date-picker/src/panel/time-range.vue

@@ -150,6 +150,9 @@
 
       handleChange() {
         if (this.minTime > this.maxTime) return;
+        MIN_TIME.setFullYear(this.minTime.getFullYear());
+        MIN_TIME.setMonth(this.minTime.getMonth());
+        MIN_TIME.setDate(this.minTime.getDate());
         this.$refs.minSpinner.selectableRange = [[MIN_TIME, this.maxTime]];
         this.$refs.maxSpinner.selectableRange = [[this.minTime, MAX_TIME]];
         this.handleConfirm(true);

+ 1 - 1
packages/date-picker/src/picker.vue

@@ -448,7 +448,7 @@ export default {
 
         this.picker.$on('dodestroy', this.doDestroy);
         this.picker.$on('pick', (date, visible = false) => {
-          if (this.dateChanged(date, this.value)) this.$emit('input', date);
+          this.$emit('input', date);
           this.pickerVisible = this.picker.visible = visible;
           this.picker.resetView && this.picker.resetView();
         });

+ 1 - 1
packages/date-picker/src/util/index.js

@@ -145,7 +145,7 @@ export const limitRange = function(date, ranges) {
   if (!ranges || !ranges.length) return date;
 
   const len = ranges.length;
-  const format = 'HH:mm:ss';
+  const format = 'yyyy-MM-dd HH:mm:ss';
 
   date = dateUtil.parse(dateUtil.format(date, format), format);
   for (let i = 0; i < len; i++) {