Skip to content

Commit

Permalink
Merge pull request iview#6408 from msidolphin/fix#6404
Browse files Browse the repository at this point in the history
fix: 修复bug iview#6404
  • Loading branch information
DebugIsFalse authored Jan 17, 2020
2 parents 50ebddc + 5c7cde1 commit eea606d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/routers/date.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
<template>
<div style="width: 500px;margin: 100px;">
<p><input type="text"></p>

<DatePicker type="month" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker>
<DatePicker type="year" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker>

Expand All @@ -260,6 +260,8 @@
<DatePicker type="daterange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker>
<DatePicker type="datetimerange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker>
<Time-Picker :steps="[1, 1, 15]" :value="new Date()"></Time-Picker>

<DatePicker type="daterange" split-panels placeholder="Select date" style="width: 200px"></DatePicker>
</div>
</template>
<script>
Expand Down
13 changes: 10 additions & 3 deletions src/components/date-picker/panel/Date/date-range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,18 @@
},
changePanelDate(panel, type, increment, updateOtherPanel = true){
const current = new Date(this[`${panel}PanelDate`]);
if (panel === 'left') {
current[`set${type}`](current[`get${type}`](), 0);
} else {
if (this.splitPanels) {
// fix #6404
current[`set${type}`](current[`get${type}`]() + increment);
} else {
if (panel === 'left') {
current[`set${type}`](current[`get${type}`]() + increment);
} else {
current[`set${type}`](current[`get${type}`]() + increment);
}
}
this[`${panel}PanelDate`] = current;
if (!updateOtherPanel) return;
Expand Down

0 comments on commit eea606d

Please sign in to comment.