Forum Replies Created

Viewing 1 replies (of 1 total)
  • We are using 5.5.3.1 version of the plugin.

    This issue is not because of the date_default_timezone_set() being there or not there. It is because of bad logic in the get_recurrence_days(). Here is what is happening …

    For events recurring based on days or week interval
    – It is converting the date part to Unixtimestamp.
    – adding 86400 * 7 for a week or 86400 for a day
    – later again coverting it back to date.

    The moment it crosses the DST day, we end up with a unixtimestamp of “yyyy-mm-dd 23:00:00” hrs time and since it is picking up only date part for recurring date from there date is of a day before. Remeber we turned our clocks back, so go to next day in DST we have to add 3600 secs. So events created during DST times are showing up one day early but on same time after DST ends.

    Though fix is simple, for it to be simple it should not rely on adding 86400 and its multiples.

    Use this fix in get_recurrence_days() in file /wp-content/plugins/events-manager/classes/em-event.php

    in CASE ‘daily’ change following

    //SR creating a string to add days(s) to the date.
     $day_interval = "+".$this->recurrence_interval." day";
     while( $current_date <= $end_date ){
       $matching_days[] = $current_date;
     //$current_date = $current_date + ($aDay * $this->recurrence_interval);
     //SR: replacing the line above with following code
     //SR: add  * recurrence interval days to ymd date
     //SR: strtottime("+1 week", $time) returns unixtimestamp with period added
        $current_date = strtotime($day_interval,$current_date);
     }

    inside CASE ‘weekly’ in the foreach loop change following

    //Loop weeks by interval until we reach or surpass end date
    //SR creating a string to add week(s) to the date.
    $week_interval = "+".$this->recurrence_interval." week";
    while($weekday_date <= $end_date){
     if( $weekday_date >= $start_date && $weekday_date <= $end_date ){
    	$matching_days[] = $weekday_date;
     }
     //$weekday_date = $weekday_date + ($aWeek *    $this->recurrence_interval);
     //SR: replacing the line above with following code
     //SR: add  * recurrence interval days to ymd date
     //SR: strtottime("+1 week", $time) returns unixtimestamp with period added
     $weekday_date = strtotime($week_interval,$weekday_date);
    
    }
Viewing 1 replies (of 1 total)