Changeset 5848
- Timestamp:
- 08/31/2017 12:24:45 PM (7 years ago)
- 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 119 119 // from the start date, advance the week until it's past now 120 120 $start = new DateTime( $post->start_date.' '.$post->time.' GMT' ); 121 $next = $start; 121 122 $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' ); 127 130 } catch (Exception $e) { 128 131 // 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.