Making WordPress.org

Changeset 5848


Ignore:
Timestamp:
08/31/2017 12:24:45 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Make/Meetings: Don't skip meetings with a Start Date later on the current week.

Fixes #1657.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php

    r3173 r5848  
    119119                    // from the start date, advance the week until it's past now
    120120                    $start = new DateTime( $post->start_date.' '.$post->time.' GMT' );
     121                    $next = $start;
    121122                    $now = new DateTime();
    122                     $interval = $start->diff($now);
    123                     // add one to days to account for events that happened earlier today
    124                     $weekdiff = ceil( ($interval->days+1) / 7 );
    125                     $next = strtotime( "{$post->start_date} + {$weekdiff} weeks" );
    126                     $post->next_date = date('Y-m-d', $next);
     123                    if ( $now > $next ) {
     124                        $interval = $start->diff($now);
     125                        // add one to days to account for events that happened earlier today
     126                        $weekdiff = ceil( ($interval->days+1) / 7 );
     127                        $next->modify('+ '.$weekdiff.' weeks');
     128                    }
     129                    $post->next_date = $next->format( 'Y-m-d' );
    127130                } catch (Exception $e) {
    128131                    // if the datetime is invalid, then set the post->next_date to the start date instead
Note: See TracChangeset for help on using the changeset viewer.