Some tuning for countdown scripts

This commit is contained in:
savvasha
2018-08-24 07:09:15 +03:00
parent 41b1ede690
commit 8e33149ab8
3 changed files with 7 additions and 1 deletions

View File

@@ -472,6 +472,9 @@ jQuery(document).ready(function($){
// Find the distance between now and the count down date
var distance = countDownDate - nowutc;
if ( distance < 0 ) {
distance = 0;
}
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));

View File

@@ -31,6 +31,9 @@ function sp_viewport() {
// Find the distance between now and the count down date
var distance = countDownDate - nowutc;
if ( distance < 0 ) {
distance = 0;
}
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));

View File

@@ -75,7 +75,7 @@ class SP_Admin_Dashboard {
$date = new DateTime( $next_event->post_date );
$interval = date_diff( $now, $date );
?>
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $post->post_date ) ); ?>">
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $next_event->post_date ) ); ?>">
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->days . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
(<?php echo $next_event->post_title; ?>)