Skip to content

Commit 538464f

Browse files
authored
Update packages/datetime2/src/components/date-range-picker3/dateRangePicker3.tsx
1 parent 603e0cd commit 538464f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/datetime2/src/components/date-range-picker3/dateRangePicker3.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ export class DateRangePicker3 extends DateFnsLocalizedComponent<DateRangePicker3
277277
this.setState({ value: newDateRange, time: newTimeRange });
278278
};
279279

280+
// When a user sets the time value before choosing a date, we need to pick a date for
281+
// them to have something to store the time on.
282+
// The default depends on the value of the other date since there's an invariant
283+
// that the left/0 date is always less than the right/1 date.
280284
private getDefaultDate = (dateIndex: number) => {
281285
const { value } = this.state;
282286
const otherIndex = dateIndex === 0 ? 1 : 0;

0 commit comments

Comments
 (0)