Update calendar on value change externally
parent
5b06d2e79d
commit
b3f90755d7
|
@ -294,10 +294,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const viewDate = this.viewDate;
|
this.updateCurrentMetaData();
|
||||||
this.currentMonth = viewDate.getMonth();
|
|
||||||
this.currentYear = viewDate.getFullYear();
|
|
||||||
this.initTime(viewDate);
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -314,6 +311,11 @@ export default {
|
||||||
maskClickListener: null,
|
maskClickListener: null,
|
||||||
mask: null,
|
mask: null,
|
||||||
timePickerTimer: null,
|
timePickerTimer: null,
|
||||||
|
watch: {
|
||||||
|
value() {
|
||||||
|
this.updateCurrentMetaData();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isSelected(dateMeta) {
|
isSelected(dateMeta) {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
|
@ -537,11 +539,16 @@ export default {
|
||||||
this.currentMinute = date.getMinutes();
|
this.currentMinute = date.getMinutes();
|
||||||
this.currentSecond = date.getSeconds();
|
this.currentSecond = date.getSeconds();
|
||||||
|
|
||||||
if (this.hourFormat == '12')
|
if (this.hourFormat == '12') {
|
||||||
this.currentHour = date.getHours() == 0 ? 12 : date.getHours() % 12;
|
if (hours >= 12)
|
||||||
|
this.currentHour = (hours == 12) ? 12 : hours - 12;
|
||||||
else
|
else
|
||||||
|
this.currentHour = (hours == 0) ? 12 : hours;
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.currentHour = date.getHours();
|
this.currentHour = date.getHours();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (this.timeOnly) {
|
else if (this.timeOnly) {
|
||||||
this.currentMinute = 0;
|
this.currentMinute = 0;
|
||||||
this.currentHour = 0;
|
this.currentHour = 0;
|
||||||
|
@ -1153,6 +1160,12 @@ export default {
|
||||||
|
|
||||||
this.overlayVisible = false;
|
this.overlayVisible = false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
updateCurrentMetaData() {
|
||||||
|
const viewDate = this.viewDate;
|
||||||
|
this.currentMonth = viewDate.getMonth();
|
||||||
|
this.currentYear = viewDate.getFullYear();
|
||||||
|
this.initTime(viewDate);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue