Fix the time used with the DateTime

The cond_start and cond_stop time format has been normalized to 24-hour time. If they are not normalized to one format, then two different formats would be needed.
This commit is contained in:
FusionPBX
2026-03-19 16:16:05 -06:00
committed by GitHub
parent 48a6c29599
commit 617e883b19

View File

@@ -315,7 +315,7 @@
//Use date-time to set the year, month, day and time
if (!empty($cond_start) && !empty($cond_stop) && $cond_var == 'date-time') {
// Extract components
$cond_start_datetime = DateTime::createFromFormat('Y-m-d h:i a', $_REQUEST['value'][$group_id][$cond_num]['start']);
$cond_start_datetime = DateTime::createFromFormat('Y-m-d H:i', $cond_start);
$cond_start_year = $cond_start_datetime->format('Y');
$cond_start_month = $cond_start_datetime->format('n');
$cond_start_day = $cond_start_datetime->format('j');
@@ -323,7 +323,7 @@
$cond_start_minute = $cond_start_datetime->format('i');
$cond_start_minutes = ($cond_start_hour * 60) + $cond_start_minute + 1;
$cond_stop_datetime = DateTime::createFromFormat('Y-m-d h:i a', $_REQUEST['value'][$group_id][$cond_num]['stop']);
$cond_stop_datetime = DateTime::createFromFormat('Y-m-d H:i', $cond_stop);
$cond_stop_year = $cond_stop_datetime->format('Y');
$cond_stop_month = $cond_stop_datetime->format('n');
$cond_stop_day = $cond_stop_datetime->format('j');