Merge pull request #3348 from SergioCrisostomo/fix-3345

Correct logic for side panel date
This commit is contained in:
Aresn 2018-04-11 15:15:19 +08:00 committed by GitHub
commit 4a1b803512
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -275,11 +275,12 @@
nextMonth(panel){ nextMonth(panel){
this.changePanelDate(panel, 'Month', 1); this.changePanelDate(panel, 'Month', 1);
}, },
changePanelDate(panel, type, increment){ changePanelDate(panel, type, increment, updateOtherPanel = true){
const current = new Date(this[`${panel}PanelDate`]); const current = new Date(this[`${panel}PanelDate`]);
current[`set${type}`](current[`get${type}`]() + increment); current[`set${type}`](current[`get${type}`]() + increment);
this[`${panel}PanelDate`] = current; this[`${panel}PanelDate`] = current;
if (!updateOtherPanel) return;
if (this.splitPanels){ if (this.splitPanels){
// change other panel if dates overlap // change other panel if dates overlap
@ -312,9 +313,8 @@
if (!this.splitPanels){ if (!this.splitPanels){
const otherPanel = panel === 'left' ? 'right' : 'left'; const otherPanel = panel === 'left' ? 'right' : 'left';
const type = currentViewType === 'year-table' ? 'FullYear' : 'Month';
this[`${otherPanel}PanelDate`] = value; this[`${otherPanel}PanelDate`] = value;
this.changePanelDate(otherPanel, type, 1); this.changePanelDate(otherPanel, 'Month', 1, false);
} }
}, },
handleRangePick (val) { handleRangePick (val) {