Skip to content

Commit a43da41

Browse files
committed
fix(Datepicker): startFrom defaults to new Date
makes sure calendar popup updates correctly when date changed manually
1 parent 48a6ce1 commit a43da41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/Datepicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Datepicker: React.FC<DatepickerType> = ({
2424
asSingle = false,
2525
placeholder = null,
2626
separator = "~",
27-
startFrom = null,
27+
startFrom = new Date(),
2828
i18n = LANGUAGE,
2929
disabled = false,
3030
inputClassName = null,
@@ -52,6 +52,7 @@ const Datepicker: React.FC<DatepickerType> = ({
5252
const [firstDate, setFirstDate] = useState<dayjs.Dayjs>(
5353
startFrom && dayjs(startFrom).isValid() ? dayjs(startFrom) : dayjs()
5454
);
55+
5556
const [secondDate, setSecondDate] = useState<dayjs.Dayjs>(nextMonth(firstDate));
5657
const [period, setPeriod] = useState<Period>({
5758
start: null,

0 commit comments

Comments
 (0)