From 2d57022a632be6c0c1d97c4533efbe00b075cc74 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 30 Mar 2020 15:42:30 +0200 Subject: [PATCH] The book advance condition must check with the provider's timezone. --- application/controllers/Appointments.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/controllers/Appointments.php b/application/controllers/Appointments.php index 6a556c19..4775d5fa 100755 --- a/application/controllers/Appointments.php +++ b/application/controllers/Appointments.php @@ -415,13 +415,15 @@ class Appointments extends CI_Controller { // an appointment that is at least half or one hour from now. The setting is stored in minutes. $selected_date = $this->input->post('selected_date'); + $provider_timezone = new DateTimeZone($provider['timezone']); + $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout'); - $threshold = new DateTime('+' . $book_advance_timeout . ' minutes'); + $threshold = new DateTime('+' . $book_advance_timeout . ' minutes', $provider_timezone); foreach ($available_hours as $index => $value) { - $available_hour = new DateTime($selected_date . ' ' . $value); + $available_hour = new DateTime($selected_date . ' ' . $value, $provider_timezone); if ($available_hour->getTimestamp() <= $threshold->getTimestamp()) {