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
8 changes: 3 additions & 5 deletions src/lib/components/DatePicker/DialogContentDesktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ const DialogContentDesktop = ({
} else {
setDisablePrev(false);
}

if (maxDate && focusDate.isAfter(dayjs(maxDate).subtract(2, 'month'), 'month')) {
if (maxDate && focusDate.isAfter(dayjs(maxDate).subtract(1, 'month'), 'month')) {
setDisableNext(true);
} else {
setDisableNext(false);
Expand Down Expand Up @@ -112,7 +111,6 @@ const DialogContentDesktop = ({

function decreaseCurrentMonth(date) {
if (disablePrev) return;

setTranslateAmount(wrapperWidth);
setTimeout(() => {
decreaseFocusDate(date);
Expand All @@ -125,8 +123,8 @@ const DialogContentDesktop = ({
if (dayjs(dateChanged).isBefore(focusDate, 'month', true)) {
decreaseCurrentMonth(dateChanged);
}
if (dayjs(dateChanged).isAfter(focusDate.add(1, 'month'), 'month', true)) {
increaseCurrentMonth(dayjs(dateChanged).subtract(1, 'month'));
if (dayjs(dateChanged).isAfter(focusDate, 'month', true)) {
increaseCurrentMonth(dateChanged);
}
}
}, [dateChanged]);
Expand Down
9 changes: 7 additions & 2 deletions src/lib/components/DatePicker/SingleDatePicker.examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import { SingleDatePicker } from 'react-google-flight-datepicker';
<div className="react-google-flight-datepicker">
<div className="date-picker-demo">
<SingleDatePicker
singleCalendar
tooltip="Hello"
singleCalendar
highlightToday
dateFormat="DD-MM-YYYY" // "DD-MM-YYYY"
startWeekDay="monday"
startDate={new Date('2020-04-20')}
maxDate={new Date('2020-04-20')}
minDate={new Date('2020-01-20')}
/>
</div>
</div>
Expand Down