Răsfoiți Sursa

DateTimePicker: Fixes DateTinePicker format is not taken into the picker itself #4931 (#5293)

* DatePicker: Fix Typing a date and tabbing does not close the calendar #4948

* DatePicker: Fix Typing a date and tabbing does not close the calendar #4948 -Updated test case

* Fixes #4931
ChuckFields 8 ani în urmă
părinte
comite
be6cc78004
1 a modificat fișierele cu 10 adăugiri și 2 ștergeri
  1. 10 2
      packages/date-picker/src/panel/date.vue

+ 10 - 2
packages/date-picker/src/panel/date.vue

@@ -406,11 +406,11 @@
 
       visibleDate: {
         get() {
-          return formatDate(this.date);
+          return formatDate(this.date, this.dateFormat);
         },
 
         set(val) {
-          const date = parseDate(val, 'yyyy-MM-dd');
+          const date = parseDate(val, this.dateFormat);
           if (!date) {
             return;
           }
@@ -445,6 +445,14 @@
         } else {
           return 'HH:mm:ss';
         }
+      },
+
+      dateFormat() {
+        if (this.format) {
+          return this.format.replace('HH:mm', '').replace(':ss', '').trim();
+        } else {
+          return 'yyyy-MM-dd';
+        }
       }
     }
   };