3 month limit setup

This commit is contained in:
2025-10-04 13:52:17 +02:00
parent 64d5a8fbf3
commit 45c192058a
2 changed files with 24 additions and 0 deletions
+14
View File
@@ -403,6 +403,20 @@ class Pages extends CI_Controller {
]));
return;
}
$today = new DateTime();
$maxDate = (clone $today)->modify('+3 months');
$selectedDate = new DateTime($bookingArray['booking_date']);
if ($selectedDate > $maxDate) {
$this->output
->set_status_header(403)
->set_content_type('application/json')
->set_output(json_encode([
'error' => 'Bookings can only be made up to 3 months in advance.'
]));
return;
}
// 6. Create booking
$this->Service_model->createBooking($bookingArray);