• Resolved christian_anton

    (@christian_anton)


    Hi!

    I have my wordpress time zone setting set to “Berlin”, which currently is GMT+2. When I schedule an event for – i. e. – 18th of april, 20.00 to 23.00 in ICAL it appears as follows:

    BEGIN:VEVENT
    UID:b9fa3d9a-6f73-49c9-81af-0a84f7a5c74e
    DTSTART:20130418T180000Z
    DTEND:20130418T213000Z
    DTSTAMP:20130331T194137Z
    SUMMARY:MTB-Stammtisch – College – 18.04.2013 – 20:00 – 23:30
    LOCATION:Collegeav-marktschwaben.de/events/mtb-stammtisch-2013-04-18/
    URL:http://www.dav-marktschwaben.de/events/mtb-stammtisch-2013-04-18/
    END:VEVENTNT

    …which is correct: the DTSTART and DTEND fields show the time “minus 2 hours” as this is UTC time and is used correctly by the calendar program and shown the right way in my calendar.

    Unfortunately, this automatic deduction of 2 hours also happens if the event is a “whole day” event, resulting in the whole event being “one day too early”. An example: a whole day event for the 4th of may:

    BEGIN:VEVENT
    UID:38470744-9e77-46c9-8af8-a012edd4e878
    DTSTART;VALUE=DATE:20130503
    DTEND;VALUE=DATE:20130504
    DTSTAMP:20130331T195649Z
    SUMMARY:MTB – Neureuth Trails – – 04.05.2013 – ganztags
    LOCATION://www.dav-marktschwaben.de/events/mtb-neureuth-trails/
    URL:http://www.dav-marktschwaben.de/events/mtb-neureuth-trails/
    END:VEVENTNT

    You see, the DTSTART and DTEND fields let the event begin and end one day too early.

    Is there already a quick fix for this one and is this behavior a known issue?

    Thanks

    Christian

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • agelonwl

    (@angelonwl)

    you can change the behavior using the template file at templates/templates/ical-event.php

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

    Thread Starter christian_anton

    (@christian_anton)

    yeah. I already use this templates solution because I patched the template to enable per-category ical subscriptions.

    I now quick-fixed the problem there by just adding one day to the start and end fields generically when it is a whole-day event, but I would suggest the developer of this plugin to fix this more globally.

    Cheers and thanks

    Christian

    agelonwl

    (@angelonwl)

    ok, maybe you can share your solution for us to see?

    thanks

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    will test this

    Thread Starter christian_anton

    (@christian_anton)

    Hi again!

    Here is the very quick fix which I would not recommend you guys to use:

    diff --git a/plugins/events-manager/templates/ical.php b/plugins/events-manager/templates/ical.php
    index f9cb39f..121fccc 100644
    --- a/plugins/events-manager/templates/ical.php
    +++ b/plugins/events-manager/templates/ical.php
    @@ -44,8 +44,16 @@ foreach ( $EM_Events as $EM_Event ) {
            /* @var $EM_Event EM_Event */
            date_default_timezone_set('UTC'); // set the PHP timezone to UTC, we already calculated event
            if($EM_Event->event_all_day){
    -               $dateStart      = ';VALUE=DATE:'.date('Ymd',$EM_Event->start); //all day
    -               $dateEnd        = ';VALUE=DATE:'.date('Ymd',$EM_Event->end + 86400); //add one day
    +
    +    /*
    +    quick-fixing time zone problem on all-day events (these appearing one day too early due to timezone conversions
    +    Canton 2013-04-18
    +     */
    +               // $dateStart   = ';VALUE=DATE:'.date('Ymd',$EM_Event->start); //all day
    +               // $dateEnd     = ';VALUE=DATE:'.date('Ymd',$EM_Event->end + 86400); //add one day
    +               $dateStart      = ';VALUE=DATE:'.date('Ymd',$EM_Event->start + 86400); //add one day
    +               $dateEnd        = ';VALUE=DATE:'.date('Ymd',$EM_Event->end + 172800); //add two days
    +
            }else{
                    $dateStart      = ':'.date('Ymd\THis\Z',$EM_Event->start);
                    $dateEnd = ':'.date('Ymd\THis\Z',$EM_Event->end);

    The reason why I do not recommend to use it: It only works for GMT+x time zones and if the subscriber of the ICAL calendar is also using a GMT+x hours time zone.

    A better way would be to fix this in a more general way, but I have not have time to dig into this yet.

    Christian

    agelonwl

    (@angelonwl)

    thanks for the update and sharing.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    we’ve changed the templates a few weeks back and it now uses wp functions to calculate offsets, we don’t use date_default_timezone_set

    i wonder if that’s your problem, you’re overriding old templates.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘whole day events appear one day before real date (ICAL)’ is closed to new replies.