Correct month last day
This commit is contained in:
parent
28a0f8b0b7
commit
3aeb2bc692
1 changed files with 12 additions and 3 deletions
|
@ -312,9 +312,18 @@
|
||||||
} else {
|
} else {
|
||||||
// keep the panels together
|
// keep the panels together
|
||||||
const otherPanel = panel === 'left' ? 'right' : 'left';
|
const otherPanel = panel === 'left' ? 'right' : 'left';
|
||||||
const otherCurrent = new Date(this[`${otherPanel}PanelDate`]);
|
const currentDate = this[`${otherPanel}PanelDate`];
|
||||||
otherCurrent[`set${type}`](otherCurrent[`get${type}`]() + increment);
|
const temp = new Date(currentDate);
|
||||||
this[`${otherPanel}PanelDate`] = otherCurrent;
|
|
||||||
|
if (type === 'Month') {
|
||||||
|
const nextMonthLastDate = new Date(
|
||||||
|
temp.getFullYear(), temp.getMonth() + increment + 1, 0
|
||||||
|
).getDate();
|
||||||
|
temp.setDate(Math.min(nextMonthLastDate, temp.getDate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
temp[`set${type}`](temp[`get${type}`]() + increment);
|
||||||
|
this[`${otherPanel}PanelDate`] = temp;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showYearPicker (panel) {
|
showYearPicker (panel) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue