forked from mirrors/easyappointments
Preselect the date with a query parameter (#1376)
This commit is contained in:
parent
66dfd36d6d
commit
4d58075ef7
1 changed files with 13 additions and 3 deletions
|
@ -300,6 +300,16 @@ App.Http.Booking = (function () {
|
|||
// Grey out unavailable dates.
|
||||
$('#select-date')[0]._flatpickr.set('disable', unavailableDates.map(unavailableDate => new Date(unavailableDate)));
|
||||
|
||||
const dateQueryParam = App.Utils.Url.queryParam('date');
|
||||
|
||||
if (dateQueryParam) {
|
||||
const dateQueryParamMoment = moment(dateQueryParam);
|
||||
|
||||
if (dateQueryParamMoment.isValid() && !unavailableDates.includes(dateQueryParam) && dateQueryParamMoment.format('YYYY-MM') === selectedDateMoment.format('YYYY-MM')) {
|
||||
$('#select-date')[0]._flatpickr.setDate(dateQueryParamMoment.toDate());
|
||||
}
|
||||
}
|
||||
|
||||
processingUnavailableDates = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue