Skip to content

fix: 区间选择,首次选择开始时间,如果选择的是右边面板,则开始时间会跳跃到左边面板,体验不太好,容易对用户造成视觉困扰,修复之 #603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/RangeCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,15 @@ class RangeCalendar extends React.Component {
if (!this.state.selectedValue[0] || !this.state.selectedValue[1]) {
const startValue = selectedValue[0] || moment();
const endValue = selectedValue[1] || startValue.clone().add(1, 'months');

if (this.state.selectedValue[0]) {
this.setState({
value: getValueFromSelectedValue([startValue, endValue])
});
}

this.setState({
selectedValue,
value: getValueFromSelectedValue([startValue, endValue]),
selectedValue
});
}

Expand Down