Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/PickerInput/SinglePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ function Picker<DateType extends object = any>(
const nextValues = multiple ? toggleDates(getCalendarValue(), date) : [date];

// Only trigger calendar event but not update internal `calendarValue` state
triggerCalendarChange(nextValues);
if(internalPicker === internalMode) {
triggerCalendarChange(nextValues);
}

// >>> Trigger next active if !needConfirm
// Fully logic check `useRangeValue` hook
Expand Down
14 changes: 14 additions & 0 deletions tests/picker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,20 @@ describe('Picker.Basic', () => {
expect(document.querySelector('.rc-picker-date-panel')).toBeTruthy();
});

it('date -> year -> month -> date: Selecting date when panel is different than the picker typ shouldn\'t auto-select dates: date -> year -> month -> date', () => {
const { container } = render(<DayPicker />);
openPicker(container);
fireEvent.click(document.querySelector('.rc-picker-year-btn'));

expect(document.querySelector('input').value).toEqual('');
selectCell(1990);
expect(document.querySelector('input').value).toEqual('');
selectCell('Jan');
expect(document.querySelector('input').value).toEqual('');
selectCell(3);
expect(document.querySelector('input').value).toEqual('1990-01-03');
});

it('time', () => {
const onChange = jest.fn();
const onOk = jest.fn();
Expand Down