Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I'm having the same issue. The calendar event is being created 6 hours later than my local time. I have no time zone override selected because I plan to use the module in multiple time zones. I attached a screenshot of my config.
// Assuming date and end_date is provide in UTC format.
$date = new DrupalDateTime(preg_replace('/T/', ' ', $this->atcDateStart), 'UTC');
$end_date = new DrupalDateTime(preg_replace('/T/', ' ', $this->atcDateEnd), 'UTC');
+1 ... also dealing with this issue in 3.x. I am in Los Angeles (-8) time, and while the date display is correct, the addtocalendar button's dates are 8 hours off.
Site default time zone: Los Angeles
New user time zone: Los Angeles
My account's time zone: Los Angeles
Field display time zone: unset (if I change it to Los Angeles, it does not make a difference)
I found that changing the field display time zone setting to UTC fixed the button. Not sure why it's not affecting the other half of the field display, or why this seems to be set up backwards.
I was having the same issue where the date/time was always showing the UTC date/time but saying it was the date/time of the time zone I have set for the site.
I found in /includes/addtocalendar.build.inc lines 60 - 63 it loads the date/time that is stored to the time zone that I have selected. I changed the code from this:
$date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$index]['value']), $timeZone);
if (!empty($values[$index]['end_value']) && isset($values[$index]['end_value'])) {
$end_date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$index]['end_value']), $timeZone);
}
To:
$tzo = new DateTimeZone($timeZone);
$date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$index]['value']), 'UTC');
$date->setTimezone($tzo);
if (!empty($values[$index]['end_value']) && isset($values[$index]['end_value'])) {
$end_date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$index]['end_value']), 'UTC');
$end_date->setTimezone($tzo);
}
I looked into this issue but not able to reproduce this issue in the latest stable release of this module. Though I tried using the #11 patch as well but it works exactly the same it worked without the patch.
Basically, If the timezone is selected in the field display time zone setting then it will pick up that timezone else it picks up the default timezone (date_default_timezone_get()).
I'm closing this for now still if anyone feels like reopening it again please feel free to do so and please explain the issue you are facing. If possible with the steps to reproduce the issue.
I'm a newer maintainer of this module. It looks like this issue is worth re-opening. I'm going to trigger the automated tests and see if anything fails. While writing the tests it looked like something was fishy because the assertions I had to write for the addtocalendar field were different from the assertions I had to write when using third party settings even though the cases appeared to me like they should give the same end result. So I'm actually hoping something fails here!
Thanks for taking over maintenance of the module @danflanagan8. I'm experiencing the timezone GMT issue with the dev version. Tried the patch and a few other things. Will report back if I find anything of importance.
This is definitely still an issue. I'm caught in a situation where I can either have the displayed date for my events be correct on the node itself while the addtocalendar widget is wrong or the other way around.
Comments
Comment #2
guptahemant commentedhi @SocialNicheGuru
can you please explain more and add screenshots of your configuration.
Thanks,
Comment #3
katyleedy commentedI'm having the same issue. The calendar event is being created 6 hours later than my local time. I have no time zone override selected because I plan to use the module in multiple time zones. I attached a screenshot of my config.
Comment #4
risforrocket commentedSame issue. My calendar events are pushing to the calendar with UTC times, regardless of if I set a timezone override or not.
Comment #5
risforrocket commentedThis seems to be a major bug. There is no way to override the date range field (with add to calendar) timezone. It is always in UTC.
Comment #6
risforrocket commentedAdded config screenshots
Comment #7
bcanini commentedAny update on this bug? Anyone figured out a solution to this?
Comment #8
drupaldevbrian commented/src/AddToCalendarApiWidget.php
Lines 103 - 105
Need to change 'UTC' to $timeZone it seems
Comment #9
tlwatson+1 ... also dealing with this issue in 3.x. I am in Los Angeles (-8) time, and while the date display is correct, the addtocalendar button's dates are 8 hours off.
Site default time zone: Los Angeles
New user time zone: Los Angeles
My account's time zone: Los Angeles
Field display time zone: unset (if I change it to Los Angeles, it does not make a difference)
I found that changing the field display time zone setting to UTC fixed the button. Not sure why it's not affecting the other half of the field display, or why this seems to be set up backwards.
Comment #10
chase.burandt commentedI was having the same issue where the date/time was always showing the UTC date/time but saying it was the date/time of the time zone I have set for the site.
I found in /includes/addtocalendar.build.inc lines 60 - 63 it loads the date/time that is stored to the time zone that I have selected. I changed the code from this:
To:
This fixed my issue I was having.
Comment #11
Miri Meltzer commentedHere's the patch to fix this issue
Comment #12
gg24 commentedComment #13
gg24 commentedI looked into this issue but not able to reproduce this issue in the latest stable release of this module. Though I tried using the #11 patch as well but it works exactly the same it worked without the patch.
Basically, If the timezone is selected in the field display time zone setting then it will pick up that timezone else it picks up the default timezone (date_default_timezone_get()).
I'm closing this for now still if anyone feels like reopening it again please feel free to do so and please explain the issue you are facing. If possible with the steps to reproduce the issue.
Thanks!
Comment #14
pameeela commentedI was having this same issue, the time zone was off despite even using a timezone override on the field.
With the patch, the issue is fixed.
Comment #15
vpa24 commentedHere's the patch to fix this issue
Comment #16
paul_serval commentedPatch for 3.x-dev
Comment #17
danflanagan8Comment #18
danflanagan8I'm a newer maintainer of this module. It looks like this issue is worth re-opening. I'm going to trigger the automated tests and see if anything fails. While writing the tests it looked like something was fishy because the assertions I had to write for the addtocalendar field were different from the assertions I had to write when using third party settings even though the cases appeared to me like they should give the same end result. So I'm actually hoping something fails here!
Comment #19
medianut commentedThanks for taking over maintenance of the module @danflanagan8. I'm experiencing the timezone GMT issue with the dev version. Tried the patch and a few other things. Will report back if I find anything of importance.
Comment #20
socialnicheguru commentedComment #21
danflanagan8We need this to be an MR before we move any further since we can't run tests on patches anymore.
Comment #22
jaydarnellThis is definitely still an issue. I'm caught in a situation where I can either have the displayed date for my events be correct on the node itself while the addtocalendar widget is wrong or the other way around.
Comment #23
jaydarnellPatch #16 appears to fix the problem for version 8.x-3.5