• Resolved kazuyk

    (@kazuyk)


    I’m using My Calendar 2.5.6 and found that the future event container tag sometimes has “past-event” class.

    I investigate the code and found that mc_event_classes() function in my-calendar-output.php adds class names.

    
    $ts  = $event->ts_occur_begin;
    $end = $event->ts_occur_end;
    $now = current_time( 'timestamp' );
    if ( $ts < $now && $end > $now ) {
        $date_relation = 'on-now';
    } else if ( $now < $ts ) {
        $date_relation = 'future-event';
    } else if ( $now > $ts ) {
        $date_relation = 'past-event';
    }
    

    I think $event->ts_occur_begin and $event->ts_occur_end are GMT, but current_time('timestamp') returns local time, so it should be current_time('timestamp', 1).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    ts_occur_begin and ts_occur_end shouldn’t be GMT. My Calendar doesn’t do anything to manipulate timezones; everything should be local time. Can you provide a link?

    Thread Starter kazuyk

    (@kazuyk)

    Certainly the values of occur_begin and occur_end are stored as local time in the db table, but I think they are converted to UTC when My Calendar execute mysql query with UNIX_TIMESTAMP(occur_begin) and UNIX_TIMESTAMP(occur_end).

    • This reply was modified 9 years, 4 months ago by kazuyk.
    Thread Starter kazuyk

    (@kazuyk)

    This problem has been fixed in 2.5.7.
    Thank you very much, Joe!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘wrong “past-event” class’ is closed to new replies.