Skip to content

Commit

Permalink
fix(date-range-picker): 修复12月时选择同一个月内的日期后,第一次打开面板左右月份一样的问题 (#2972)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyan-u authored and uyarn committed Dec 15, 2023
1 parent c7c00c1 commit d76e54f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/date-picker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ export default defineComponent({
} else if (value.value.length === 2 && !props.enableTimePicker) {
// 确保右侧面板月份比左侧大 避免两侧面板月份一致
const nextMonth = value.value.map((v: string) => parseToDayjs(v, formatRef.value.format).month());
year.value = value.value.map((v: string) => parseToDayjs(v, formatRef.value.format).year());
if (year.value[0] === year.value[1] && nextMonth[0] === nextMonth[1]) {
nextMonth[0] === 11 ? (nextMonth[0] -= 1) : (nextMonth[1] += 1);
}
month.value = nextMonth;
year.value = value.value.map((v: string) => parseToDayjs(v, formatRef.value.format).year());
// 月份季度选择时需要确保右侧面板年份比左侧大
if ((props.mode === 'month' || props.mode === 'quarter') && year.value[0] === year.value[1]) {
year.value = [year.value[0], year.value[0] + 1];
Expand Down

0 comments on commit d76e54f

Please sign in to comment.