WordPress.org

Support

Support » Plugins and Hacks » [Resolved] ical and Google Calendar add one hour to the time of the event

[Resolved] ical and Google Calendar add one hour to the time of the event

Viewing 15 replies - 1 through 15 (of 33 total)
  • angelo_nwl

    @angelo_nwl

    NetWebLogic Support

    can I know what is your current EM version please?

    EM Version 5.5.2.1
    WordPress 3.8
    thanks!

    Hiya,

    1. It sounds like Google misinterpreting the dates here. I’ve checked the iCal and the date/time is listed correctly, which your PC is correctly interpreting but Google Calendar has it wrong. I’d suggest contacting them about this bug.

    2. What is the timezone of your Google Calendar account? The iCal lists the times as 06:00-21:30 which should be the UTC time. However, if your WP & server timezone are on +01:00 it would suggest EM is getting the UTC time wrong somehow.

    Thanks

    I’ve made other tries and a research and now I think that I understood where the problem is. EM passes a wrong time because of the local time that changes on 30 March 2014. Maybe EM takes into consideration only of the time change and not of the Daylight saving time.
    I’ve inserted an event on 29th March and this one works correctly http://www.welcometomaremma.com/toskanaitalien/events/event-29-marzo/
    All the events inserted after that date have one hour more, as there wasn’t removed the hour of the time change.
    Exaple
    UTC 17.10
    Local time in Italy 18.10
    Local time of 30 March 2014 19.10
    As you can see WP, depending on the time zone gives also the Daylight saving time begins
    https://dl.dropboxusercontent.com/u/4304011/eventsmanager/timezonerome.png

    Can you let me know how to solve this?

    caimin_nwl

    @caimin_nwl

    NetWebLogic Support

    If you change the timezone from Rome to UTC + 1 (under Manual Offsets) does the correct the problem?

    I’ve set UTC +1, but it didn’t work. Google Calendar wants the UTC time which in Italy is given by the UTC+1+1 Daylight saving time.
    When the data is imported in the calendar, it is elaborated according to the setting of the Google Calendar and in case that the user is an Italian, it will be set on Rome+1and therefore Google knows also the periods in which will applied the summertime.
    The only solution to be able to use the function of Google Calendar is to calculate correctly the UTC time and therefore to remove the Daylight saving time when it is applied.

    To minimize potential disruptions of these changes, Google Calendar relies on UTC time (Coordinated Universal Time, previously known as Greenwich Mean Time or GMT) — a single “true” time — to help avoid conflicts in all locations.
    Google Calendar gets time zone information from the IANA Time Zone Database.

    How Google Calendar works with time zones? https://support.google.com/calendar/answer/2367918?hl=en

    Is it possible to solve this?

    Okay, so iCal always uses UTC. So when EM creates the iCal it has to take the start/end times you’ve set and convert them to UTC.

    It looks like what might be happening is that it does this based on the current timezone, failing to realise the dates it’s dealing with will be subject to daylight savings.

    I’ll pass this onto Marcus to take a look.

    Thanks

    Right, I’ve just tested this on my own install and it’s working as it should be.

    Can you confirm the versions of WP and EM you are using please?

    Thanks

    P.s. “UTC time (Coordinated Universal Time, previously known as Greenwich Mean Time or GMT) ” isn’t actually true – UTC is the same as UTC, but doesn’t replace it 😉

    Confirm
    WordPress 3.8 and EM Version 5.5.2.1

    Thanks!

    Plugin Author Marcus

    @netweblogic

    hey @flovida

    I think this is a problem that may happen on a handful of server setups.

    I have a theory though… it’s a little bit of a long explanation so before i do that, if you can test this out that’d help! given we don’t get this ourselves it needs to be tested on your site.

    Replace lines 34-35 on templates/templates/ical.php with

    $dateStart	= ':'.get_gmt_from_date($EM_Event->event_start_date.' '.$EM_Event->event_start_time, 'Ymd\THis\Z');
    $dateEnd = ':'.get_gmt_from_date($EM_Event->event_end_date.' '.$EM_Event->event_end_time, 'Ymd\THis\Z');

    let us know if that works for you

    Hi Marcus,
    I’ve substituted as you told me, but it seems that everything is still working in the same way. I’ve resaved the event I have tested, as I wasn’t sure if Ical was created at the moment I create the event.

    The problem is to have the real UTC that is the same all over the world. The only way to pass the dates to google calendar is to remove the time zone and the summer time.

    As you can see from this image
    https://dl.dropboxusercontent.com/u/4304011/eventsmanager/timezonerome.png
    WP knows the real time, local time and when needs to be applied the summer time (daylight saving time).

    From my point of view, the best solution is to use the WP info to make use best the cal on EM.

    I’ve made several tries and I think that it is possible to solve the problem without any calculations, using the local time (the one inserted inside of the event).

    The solution is to remove Z at the end of the time, as from the examples:

    Google Calendar:
    http://www.google.com/calendar/event?action=TEMPLATE&text=Event+29+marzo&dates=20140329T080000Z/20140329T220000Z&details=………

    this must be

    http://www.google.com/calendar/event?action=TEMPLATE&text=Event+29+marzo&dates=20140329T080000/20140329T220000&details=………

    File .ics

    DTSTART:20140529T090000Z
    DTEND:20140529T230000Z

    should be

    DTSTART;VALUE=DATE-TIME:20140529T090000
    DTEND;VALUE=DATE-TIME:20140529T230000

    Please let me know if it is possible to do it.

    caimin_nwl

    @caimin_nwl

    NetWebLogic Support

    If these are adjustments you want to make to the ical template you can copy and modify the /events-manager/templates/templates/ical.php template.

    Using Template Files

    I have the same problem. Can’t wait for your solution 🙂

    As it is now, EM passes to Google Calendar a wrong value, as it doesn’t calculate the daylight saving time (in Italy it is this year on 30th March and on 26th October).

    Demo of your events are interpreted in the wrong way
    This is the event: http://demo.wp-events-plugin.com/events/jeff-foxworthy-main/
    This is what my Google Calendar importes: https://dl.dropboxusercontent.com/u/8768599/eventsmanager/calendarEM.png
    the solution I’ve proposed you is the most simplest one to solve this problem. There are more complex solutions that might be analized

    The solution is to remove Z at the end of the time, as from the examples:

    Google Calendar:
    http://www.google.com/calendar/event?action=TEMPLATE&text=Event+29+marzo&dates=20140329T080000Z/20140329T220000Z&details=………

    this must be

    http://www.google.com/calendar/event?action=TEMPLATE&text=Event+29+marzo&dates=20140329T080000/20140329T220000&details=………

    File .ics

    DTSTART:20140529T090000Z
    DTEND:20140529T230000Z

    should be

    DTSTART;VALUE=DATE-TIME:20140529T090000
    DTEND;VALUE=DATE-TIME:20140529T230000

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘[Resolved] ical and Google Calendar add one hour to the time of the event’ is closed to new replies.