Comments

SocialNicheGuru created an issue. See original summary.

guptahemant’s picture

hi @SocialNicheGuru

can you please explain more and add screenshots of your configuration.

Thanks,

katyleedy’s picture

StatusFileSize
new85.4 KB

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.

risforrocket’s picture

Same issue. My calendar events are pushing to the calendar with UTC times, regardless of if I set a timezone override or not.

risforrocket’s picture

This 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.

risforrocket’s picture

Added config screenshots

bcanini’s picture

Any update on this bug? Anyone figured out a solution to this?

drupaldevbrian’s picture

/src/AddToCalendarApiWidget.php

Lines 103 - 105

// 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');

Need to change 'UTC' to $timeZone it seems

tlwatson’s picture

+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.

chase.burandt’s picture

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);
}

This fixed my issue I was having.

Miri Meltzer’s picture

Here's the patch to fix this issue

gg24’s picture

Assigned: Unassigned » gg24
gg24’s picture

Assigned: gg24 » Unassigned
Status: Active » Closed (cannot reproduce)

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.

Thanks!

pameeela’s picture

I 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.

vpa24’s picture

Here's the patch to fix this issue

paul_serval’s picture

Patch for 3.x-dev

danflanagan8’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
Status: Closed (cannot reproduce) » Active
danflanagan8’s picture

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!

medianut’s picture

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.

socialnicheguru’s picture

Status: Active » Needs review
danflanagan8’s picture

Status: Needs review » Needs work

We need this to be an MR before we move any further since we can't run tests on patches anymore.

jaydarnell’s picture

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.

jaydarnell’s picture

Patch #16 appears to fix the problem for version 8.x-3.5