DatePicker: fix time range

pull/2968/head
qingwei.li 2017-02-22 17:30:37 +08:00 committed by 杨奕
parent 96c8ac0876
commit 58c19ebaf0
2 changed files with 2 additions and 3 deletions

View File

@ -134,7 +134,7 @@
handleConfirm(visible = false, first) {
if (first) return;
const date = new Date(limitRange(this.currentDate, this.selectableRange));
const date = new Date(limitRange(this.currentDate, this.selectableRange, 'HH:mm:ss'));
this.$emit('pick', date, visible, first);
},

View File

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