Guard against departure date not having min and max night attributes
This commit is contained in:
parent
33a1f0f4e2
commit
97fb88cc02
|
@ -11,7 +11,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const minNights = Math.max(1, parseInt(departureDateField.dataset.minNights, 10));
|
||||
const minNights = Math.max(1, parseInt(departureDateField.dataset.minNights, 10) || 0);
|
||||
arrivalDate.setUTCDate(arrivalDate.getUTCDate() + minNights);
|
||||
const minDate = formatDate(arrivalDate);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
departureDateField.value = minDate;
|
||||
}
|
||||
|
||||
const maxNights = parseInt(departureDateField.dataset.maxNights, 10);
|
||||
const maxNights = parseInt(departureDateField.dataset.maxNights, 10) || 0;
|
||||
if (maxNights > 0) {
|
||||
arrivalDate.setUTCDate(arrivalDate.getUTCDate() + maxNights - minNights);
|
||||
const maxDate = formatDate(arrivalDate);
|
||||
|
|
Loading…
Reference in New Issue