fixed have_to_run method

master
campi 2 years ago
parent 758d5113ed
commit 437d5e1352

@ -9,11 +9,11 @@ function have_to_run_this_week($start_date, $cadence)
break;
case 2:
case 4:
$date = getdate(strtotime($start_date));
$today = getdate(date("U"));
$today = new DateTime();
$date = new DateTime($start_date);
$modulo = 7 * $cadence;
$date_difference = date_diff($today, $date);
$days_difference = $date_difference["days"];
$days_difference = $date_difference->days;
if (($days_difference % $modulo) < 7) {
$return_value = true;
break;
@ -21,8 +21,8 @@ function have_to_run_this_week($start_date, $cadence)
$return_value = false;
break;
}
return $return_value
return $return_value;
}
function show_palinsesto($args)
@ -78,7 +78,7 @@ function show_palinsesto($args)
$rerun_start_date = get_post_meta($post->ID, 'rerun_start_date_'.$d, true);
if (empty($rerun_cadence) || empty($rerun_start_date)) {
$rerun_cadence = "1";
$rerun_cadence = "1"; //default settimanale
}
if (!empty($rerun_day)&&!empty($rerun_start)&&!empty($rerun_end)) {

Loading…
Cancel
Save