WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] ical and Google Calendar add one hour to the time of the event (32 posts)

  1. flovida
    Member
    Posted 6 months ago #

    I've added ical and google calendar to the events of EM and discovered two problems:

    1. If the event is for the whole day, when I import it on GOOGLE CALENDAR it is recognized as the day before, whereas the pc calendar recognizes the date correctly
    http://www.welcometomaremma.com/toskanaitalien/events/sagra-di-suvereto/

    2. I've inserted the starting/ending time of the event, eg. 08.00 - 23.30 and when I import it with ical and google calendar the times become 09.00 -00-30
    http://www.welcometomaremma.com/toskanaitalien/events/palio-di-siena-2-juli-2014-07-02/

    I've checked the system time and the WordPress time and both are set on (GMT +01:00 Europe/Rome)
    Why? How can I solve this problem?

    http://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 6 months ago #

    can I know what is your current EM version please?

  3. flovida
    Member
    Posted 6 months ago #

    EM Version 5.5.2.1
    WordPress 3.8
    thanks!

  4. philipjohn
    Member
    Posted 6 months ago #

    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

  5. flovida
    Member
    Posted 6 months ago #

    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?

  6. caimin_nwl
    NetWebLogic Support
    Posted 6 months ago #

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

  7. flovida
    Member
    Posted 6 months ago #

    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?

  8. philipjohn
    Member
    Posted 6 months ago #

    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

  9. philipjohn
    Member
    Posted 6 months ago #

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

  10. flovida
    Member
    Posted 6 months ago #

    Confirm
    WordPress 3.8 and EM Version 5.5.2.1

    Thanks!

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 6 months ago #

    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

  12. flovida
    Member
    Posted 6 months ago #

    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.

  13. flovida
    Member
    Posted 6 months ago #

    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.

  14. caimin_nwl
    NetWebLogic Support
    Posted 6 months ago #

    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.

    http://wp-events-plugin.com/documentation/using-template-files/

  15. joannarejdych
    Member
    Posted 6 months ago #

    I have the same problem. Can't wait for your solution :)

  16. flovida
    Member
    Posted 6 months ago #

    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

  17. joannarejdych
    Member
    Posted 6 months ago #

    but how can I modify File .ics?

    If i remove Z from ical.php code it doesn't work

    $dateStart	= ':'.get_gmt_from_date(date('Y-m-d H:i:s', $EM_Event->start), 'Ymd\THis\Z');
    			$dateEnd = ':'.get_gmt_from_date(date('Y-m-d H:i:s', $EM_Event->end), 'Ymd\THis\Z');
    		}
    		if( !empty($EM_Event->event_date_modified) && $EM_Event->event_date_modified != '0000-00-00 00:00:00' ){
    			$dateModified =  get_gmt_from_date($EM_Event->event_date_modified, 'Ymd\THis\Z');
    		}else{
    		    $dateModified = get_gmt_from_date($EM_Event->post_modified, 'Ymd\THis\Z');

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  18. flovida
    Member
    Posted 6 months ago #

    Please give me some time an I will pass you my modifie file!

  19. flovida
    Member
    Posted 6 months ago #

    Hi,
    I've changed the em-event.php situated in /wp-content/plugins/events-manager/classes
    could you please have a look at my page and try to add the following event and you will see that independently from your geographic area the event will be added with the standard time in Rome. This allows to everone to have the correct time in respect to the own standard time. You will see in google calendar the field "(GMT+01:00) Roma"that will indicate you to which standard time the event is referred.

    http://www.welcometomaremma.com/toskanaitalien/events/palio-di-siena-2-juli-2014-07-02/

    I wanted to modify also the file ical.php, thus ical me shows the inserted time without changing it because of the standard time.

    How can I do this?

  20. caimin_nwl
    NetWebLogic Support
    Posted 6 months ago #

    @joannarejdych Can repost your code using the code button, in case it got mangled the first time? Thanks.

  21. flovida
    Member
    Posted 6 months ago #

    Hi @joannarejdych,
    I've done it in this way (but should be fixed by the plugin-creators):

    substituted from line 34 until 40 the following code

    $dateStart	= ':'.get_gmt_from_date($EM_Event->event_start_date.' '.$EM_Event->event_start_time, 'Ymd\THis');
    			$dateEnd = ':'.get_gmt_from_date($EM_Event->event_end_date.' '.$EM_Event->event_end_time, 'Ymd\THis');
    		}
    		if( !empty($EM_Event->event_date_modified) && $EM_Event->event_date_modified != '0000-00-00 00:00:00' ){
    			$dateModified =  get_gmt_from_date($EM_Event->event_date_modified, 'Ymd\THis');
    		}else{
    		    $dateModified = get_gmt_from_date($EM_Event->post_modified, 'Ymd\THis');

    substituted the lines 69 and 70 with the following code

    DTSTART;VALUE=DATE-TIME{$dateStart}
    DTEND;VALUE=DATE-TIME{$dateEnd}

    unfortunately I was not able to understand in which part of the code is removed or added the standard time.

    You can fix DSTART and DTEND considering the following syntax:
    DTSTART:20140714T133000 ;Local time
    DTSTART:20140714T123000Z ;UTC time
    DTSTART;Europe/Rome:20140714T133000 ;Local time and time
    ; zone reference

  22. flovida
    Member
    Posted 6 months ago #

    Hi @joannarejdych,
    For Google calendar I've done it in this way and works:
    substituted the lines 1708 and 1709 with the following code

    $dateStart	= date('Ymd',$this->start);
    $dateEnd	= date('Ymd',$this->start);

    substituted the line 1715 with the following code

    $gcal_url = 'http://www.google.com/calendar/event?action=TEMPLATE&text=event_name&ctz=Europe/Rome&dates=start_date/end_date&details=post_content&location=location_name&trp=false&sprop=event_url&sprop=name:blog_name';

    Substitute Europe/Rome with your geographic area

    the file is: em-event.php in wp-content/plugins/events-manager/classes

  23. joannarejdych
    Member
    Posted 6 months ago #

    So @flovida you mean to change:

    if($this->event_all_day && $this->event_start_date == $this->event_end_date){
    						$dateStart	= date('Ymd',$this->start - (60*60*get_option('gmt_offset')));
    						$dateEnd	= date('Ymd',$this->start + 60*60*24 - (60*60*get_option('gmt_offset')));
    					}else{
    						$dateStart	= date('Ymd\THis\Z',$this->start - (60*60*get_option('gmt_offset')));
    						$dateEnd = date('Ymd\THis\Z',$this->end - (60*60*get_option('gmt_offset')));
    					}
    					//build url
    					$gcal_url = 'http://www.google.com/calendar/event?action=TEMPLATE&text=event_name&dates=start_date/end_date&details=post_content&location=location_name&trp=false&sprop=event_url&sprop=name:blog_name';

    info this?:

    if($this->event_all_day && $this->event_start_date == $this->event_end_date){
    						$dateStart	= date('Ymd',$this->start);
    $dateEnd	= date('Ymd',$this->start);
    					}else{
    						$dateStart	= date('Ymd\THis\Z',$this->start - (60*60*get_option('gmt_offset')));
    						$dateEnd = date('Ymd\THis\Z',$this->end - (60*60*get_option('gmt_offset')));
    					}
    					//build url
    					$gcal_url = 'http://www.google.com/calendar/event?action=TEMPLATE&text=event_name&ctz=Europe/Rome&dates=start_date/end_date&details=post_content&location=location_name&trp=false&sprop=event_url&sprop=name:blog_name';

    I did it but it created only information about time zone in google calendar without changing the time.

    any idea?

  24. flovida
    Member
    Posted 6 months ago #

    you should have the Local time and time zone reference.
    Google Calendar calculates the real UTC.
    try my event
    http://www.google.com/calendar/event?action=TEMPLATE&text=Palio+di+siena+2+Juli&ctz=Europe/Rome&dates=20140702T080000/20140702T233000&details=Palio+di+siena+2+Juli&location=Siena&trp=false&sprop=http%3A%2F%2Fwww.welcometomaremma.com%2Ftoskanaitalien%2Fevents%2Fpalio-di-siena-2-juli-2014-07-02%2F&sprop=name:Toskana+Italien+-+Der+Toskana-Blog

  25. joannarejdych
    Member
    Posted 6 months ago #

    your event is at 12:00
    My local time is the same as Rome, it is Warsaw.

  26. flovida
    Member
    Posted 6 months ago #

    my event start 02 07 2014 - 08.00 to 23.30
    my google calendar: https://www.dropbox.com/s/xyksetz6rwhyw2w/eventdemo.png

  27. joannarejdych
    Member
    Posted 6 months ago #

    hi,
    I pasted it second time (now from forum page, previously from my email) and now i can see the same data as you mentioned.

  28. flovida
    Member
    Posted 6 months ago #

    OK! now you have the local time GMT+1Rome

  29. flovida
    Member
    Posted 6 months ago #

  30. joannarejdych
    Member
    Posted 6 months ago #

Reply »

You must log in to post.

About this Plugin

About this Topic