diff --git a/src/panel/time.js b/src/panel/time.js index 9d29a84..bdad519 100644 --- a/src/panel/time.js +++ b/src/panel/time.js @@ -72,7 +72,8 @@ export default { let hours = Math.floor(timeMinutes / 60) let minutes = timeMinutes % 60 let value = { - hours, minutes + hours, + minutes } result.push({ value, @@ -82,11 +83,13 @@ export default { } return result } - }, render (h) { - const date = new Date(this.value) - const disabledTime = typeof this.disabledTime === 'function' && this.disabledTime + const date = this.value + ? new Date(this.value) + : new Date().setHours(0, 0, 0, 0) + const disabledTime = + typeof this.disabledTime === 'function' && this.disabledTime let pickers = this.getTimeSelectOptions() if (Array.isArray(pickers) && pickers.length) { @@ -98,32 +101,39 @@ export default {
  • {picker.label}
  • + onClick={this.pickTime.bind(this, time)} + > + {picker.label} + ) }) return (
    - +
    ) } const hours = Array.apply(null, { length: 24 }).map((_, i) => { const time = new Date(date).setHours(i) - return
  • {this.stringifyText(i)}
  • + return ( +
  • + {this.stringifyText(i)} +
  • + ) }) const step = this.minuteStep || 1 @@ -131,26 +141,34 @@ export default { const minutes = Array.apply(null, { length }).map((_, i) => { const value = i * step const time = new Date(date).setMinutes(value) - return
  • {this.stringifyText(value)}
  • + return ( +
  • + {this.stringifyText(value)} +
  • + ) }) const seconds = Array.apply(null, { length: 60 }).map((_, i) => { const time = new Date(date).setSeconds(i) - return
  • {this.stringifyText(i)}
  • + return ( +
  • + {this.stringifyText(i)} +
  • + ) }) let times = [hours, minutes] @@ -159,16 +177,11 @@ export default { } times = times.map(list => ( -