Commit 61d5d48b9c1d1cb3a39d5df1336760c0024f02fb

Authored by Rijn
1 parent daa9827c

return array of format string when type is datetimerange

examples/routers/date.vue
@@ -2,12 +2,16 @@ @@ -2,12 +2,16 @@
2 <div> 2 <div>
3 <Date-picker transfer type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker> 3 <Date-picker transfer type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker>
4 <Date-picker type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker> 4 <Date-picker type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker>
5 - <Date-picker type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker> 5 + <Date-picker type="datetimerange" placeholder="选择日期" style="width: 200px" @on-change="changeDate"></Date-picker>
6 </div> 6 </div>
7 </template> 7 </template>
8 <script> 8 <script>
9 export default { 9 export default {
10 - 10 + methods: {
  11 + changeDate(date){
  12 + console.log(date);
  13 + }
  14 + }
11 } 15 }
12 </script> 16 </script>
13 17
src/components/date-picker/picker.vue
@@ -459,7 +459,7 @@ @@ -459,7 +459,7 @@
459 ).formatter; 459 ).formatter;
460 460
461 let newDate = formatter(date, format); 461 let newDate = formatter(date, format);
462 - if (type === 'daterange' || type === 'timerange') { 462 + if (type === 'daterange' || type === 'timerange' || type === 'datetimerange') {
463 newDate = [newDate.split(RANGE_SEPARATOR)[0], newDate.split(RANGE_SEPARATOR)[1]]; 463 newDate = [newDate.split(RANGE_SEPARATOR)[0], newDate.split(RANGE_SEPARATOR)[1]];
464 } 464 }
465 return newDate; 465 return newDate;