Skip to content

Commit

Permalink
Bug fix: autoset next day end when possible
Browse files Browse the repository at this point in the history
Invalid less than comparison & timezone offset applied by mistake.
  • Loading branch information
joedolson committed Sep 11, 2024
1 parent e59d968 commit 68ba506
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/my-calendar-event-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,10 @@ function mc_check_data( $action, $post, $i, $ignore_required = false ) {
$endtime = '23:59:59';
}

if ( $endtime < $time && $end === $begin ) {
if ( ( strtotime( $end . ' ' . $endtime ) < strtotime( $begin . ' ' . $time ) ) && $end === $begin ) {
// If the endtime is earlier than the start time but the dates are the same.
// the user most likely is creating a late night event that ends on the next day.
$end = mc_date( 'Y-m-d', mc_strtotime( $end . ' + 1 day' ) );
$end = mc_date( 'Y-m-d H:i', mc_strtotime( $end . ' + 1 day' ), false );
}
// Verify formats.
$time = mc_date( 'H:i:s', mc_strtotime( $time ), false );
Expand Down

0 comments on commit 68ba506

Please sign in to comment.