Home Forums Event Espresso Premium Event Calendar Invite Timezone Issues

Event Calendar Invite Timezone Issues

Posted: July 20, 2022 at 3:16 pm


July 20, 2022 at 3:16 pm

I would like to revisit this post, which has been closed:

@Tony, would you be so kind as to elaborate on your response here?

  • I set up an ACF field with name ‘event_timezone’ to match the gist and added it to my Events Posts. That’s working well.
  • I notice that if I change the value of that field, it doesn’t seem to affect the time of the ics invite, unfortunately…
  • But if I change line 18 from ‘Pacific’ to ‘Eastern’ for example, then the ics file time shifts… though not in the direction I expected :).
  • So things are ‘working’ but just need some tweaking.

Again, if you’d be so kind as to quickly elaborate how the custom field/gist works, that’d be most appreciated. Or if possible, provide an example. Much obliged.



  • Support Staff

July 21, 2022 at 4:33 am

Hi there,

Just to note, the code in that gist is intended as an example of how you can hook into the iCal data rather than being a full solution for this.

That code is checking for a value of ‘Pacific’ within a custom field with the name ‘event_timezone’, so as it stands if your using that it will only do ‘something’ when the custom field value matches the code.

Right now if the event_timezone custom field is set to Pacific, that code just creates a new date object using the DateTime’s start value + 1 hour, that’s what this code does:

$ics_data['DTSTART'] = date(
    $datetime->start() + HOUR_IN_SECONDS

That’s replacing the current DTSTART value with a new date, using the iCAL datetime format and passing $datetime->start() + HOUR_IN_SECONDS as the timestamp to work from (its basically exactly the same thing the iCal function is doing with 1 hour added).

Here is a modified version which sets the timezone you provide onto the datetime itself, then uses the datetime to regenerate the dates again:

Note that you need to make sure that the value you set for event_timezone (if setting one on the event) is a valid timezone for this to work correctly.


July 24, 2022 at 11:26 pm

Thanks for this. I truly appreciate it. That said, I couldn’t get it to work.

After fixing for the valid timezone formatting (thanks for the tip), it seems no matter what I do, the time in the ics file doesn’t seem to change.

ACF field:
In event:
Code snippet:

I must be missing something. Maybe I’ll just hire someone who knows what they’re doing. Otherwise… feature request?

Thanks again.


  • Support Staff

July 26, 2022 at 9:59 am

Yeah, my apologies!

That would be because I’m using a method you can’t use for the above.

$datetime->start() and $datetime->end() are the raw values from the DB, they don’t have the timezone offset applied to them and during testing I switch my timezone locally on my site… which messed up testing that snippet (whoops).

I’ve updated my gist to use one of our helper methods to apply the timezone on the fly, that should work correctly now.


July 29, 2022 at 1:21 pm

This worked, mostly. Thanks! I needed a small workaround though:

It seems to grab the time as UTC despite my Phoenix timezone settings:

So I tricked the ACF field to calculate the offset:

One problem: Can’t do Los Angeles as there aren’t any cities located in UTC -1:00!

Anyhow, any further wisdom is appreciated. And thank you for your help here.


Joao Victor

  • Support Staff

August 8, 2022 at 5:44 pm

Hi there,

Thanks for getting back to us.

Since Tony is more familiar with your case, I am reaching him to check your last response.


August 12, 2022 at 3:21 pm

Thank you Joao. Turns out I actually need some support here. I thought I had it working but I don’t… Appreciate your/Tony’s help. Much obliged.


  • Support Staff

August 15, 2022 at 7:33 am

One problem: Can’t do Los Angeles as there aren’t any cities located in UTC -1:00!

Huh? Can’t you just pass a timezone of America/Los_Angeles, that’s exactly what WordPress does currently.

Thank you Joao. Turns out I actually need some support here. I thought I had it working but I don’t… Appreciate your/Tony’s help. Much obliged.

Can you add more details about what isn’t working? The snippet is working for me so I’m not sure what is happening on your site?


August 15, 2022 at 12:24 pm

As mentioned before, it seems that despite WP Settings>>General>>Timezone=Phoenix, it thinks I’m in UTC/GMT. That’s where the weirdness begins…

Here in the States I’m attempting to cover events in 4 timezones: Pacific/Mountain/Central/Eastern.

Without understanding what’s broken, after trial+error, I’ve reached a solution:

Atlantic/Stanley : Eastern
America/Noronha : Central
Atlantic/Cape_Verde : Mountain
Atlantic/Reykjavik : Pacific

(Phoenix is currently in Pacific time, so Atlantic/Reykjavik (UTC/GMT) = me.)

This is interesting for a few reasons:

  • It seems counterintuitive, going in the OPPOSITE direction of the real timezones. This was my problem with the first try.
  • Daylight saving should NOT be (is already?) accounted for (i.e. the solution required cities that do not observe DST).

I’ve tried it on a brand new bare local instance (only three plugins: EE, Snippets, and ACF) and a big live instance (many plugins) with equal positive results.

Feel free to close the ticket as this time I’ve got it working.

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso