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.

Y-m-d H:i      24-hour format
Y-m-d h:i a   12-hour format with AM/PM
This commit is contained in:
FusionPBX
2026-03-19 16:15:31 -06:00
committed by GitHub
parent ef5d733978
commit 45ae47f4a1
+2 -2
View File
@@ -315,7 +315,7 @@
//Use date-time to set the year, month, day and time //Use date-time to set the year, month, day and time
if (!empty($cond_start) && !empty($cond_stop) && $cond_var == 'date-time') { if (!empty($cond_start) && !empty($cond_stop) && $cond_var == 'date-time') {
// Extract components // 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_year = $cond_start_datetime->format('Y');
$cond_start_month = $cond_start_datetime->format('n'); $cond_start_month = $cond_start_datetime->format('n');
$cond_start_day = $cond_start_datetime->format('j'); $cond_start_day = $cond_start_datetime->format('j');
@@ -323,7 +323,7 @@
$cond_start_minute = $cond_start_datetime->format('i'); $cond_start_minute = $cond_start_datetime->format('i');
$cond_start_minutes = ($cond_start_hour * 60) + $cond_start_minute + 1; $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_year = $cond_stop_datetime->format('Y');
$cond_stop_month = $cond_stop_datetime->format('n'); $cond_stop_month = $cond_stop_datetime->format('n');
$cond_stop_day = $cond_stop_datetime->format('j'); $cond_stop_day = $cond_stop_datetime->format('j');