Skip to content

Commit 63c9583

Browse files
authored
gpld-push-min-date-to-next-day-after-set-time.php: Fixed an issue with timezones.
1 parent 5ae5727 commit 63c9583

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gp-limit-dates/gpld-push-min-date-to-next-day-after-set-time.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
$current_time = new DateTime( wp_timezone_string() );
1414
$cutoff_time = ( new DateTime( wp_timezone_string() ) )->setTime( $cutoff_hour, 0 );
1515
if ( $current_time > $cutoff_time ) {
16-
$options['minDate'] = wp_date( 'm/d/Y', strtotime( 'midnight tomorrow', $current_time->getTimestamp() ) );
16+
$tomorrow = new DateTime( 'tomorrow midnight', $current_time->getTimezone() );
17+
$options['minDate'] = wp_date( 'm/d/Y', $tomorrow->getTimestamp() );
1718
}
1819
return $options;
1920
} );

0 commit comments

Comments
 (0)