Use the last picked date as reference for the date panel

This commit is contained in:
Sergio Crisostomo 2018-03-05 08:59:25 +01:00
parent 2332ac9bff
commit 02859de9b1
2 changed files with 7 additions and 2 deletions

View file

@ -92,7 +92,11 @@
mixins: [ Mixin, Locale, DateMixin ],
components: { Icon, DateTable, YearTable, MonthTable, TimePicker, Confirm, datePanelLabel },
props: {
// in the mixin
// more props in the mixin
multiple: {
type: Boolean,
default: false
}
},
data () {
const {selectionMode, value} = this;
@ -141,7 +145,7 @@
watch: {
value (newVal) {
this.dates = newVal;
this.panelDate = this.startDate || this.dates[0] || new Date();
this.panelDate = this.startDate || (this.multiple ? this.dates[this.dates.length - 1] : this.dates[0]) || new Date();
},
currentView (currentView) {
this.$emit('on-selection-mode-change', currentView);

View file

@ -47,6 +47,7 @@
:split-panels="splitPanels"
:show-week-numbers="showWeekNumbers"
:picker-type="type"
:multiple="multiple"
:time-picker-options="timePickerOptions"