Fix timezone issue with add-to-google link of the booking page (#1216)

This commit is contained in:
Alex Tselegidis 2022-02-24 15:58:30 +01:00
parent 9fbe6c6b8b
commit dce26bafe0

View file

@ -336,10 +336,18 @@ class Appointments extends EA_Controller {
$company_name = $this->settings_model->get_setting('company_name');
$appointment_start_instance = new DateTime($appointment['start_datetime']);
$provider_timezone_instance = new DateTimeZone($provider['timezone']);
$utc_timezone_instance = new DateTimeZone('UTC');
$appointment_start_instance = new DateTime($appointment['start_datetime'], $provider_timezone_instance);
$appointment_start_instance->setTimezone($utc_timezone_instance);
$appointment_end_instance = new DateTime($appointment['end_datetime']);
$appointment_end_instance = new DateTime($appointment['end_datetime'], $provider_timezone_instance);
$appointment_end_instance->setTimezone($utc_timezone_instance);
$add_to_google_url_params = [
'action' => 'TEMPLATE',
'text' => $service['name'],