diff --git a/src/Forms/DropdownDatetimeField.php b/src/Forms/DropdownDatetimeField.php index 287f583..f89c3a8 100644 --- a/src/Forms/DropdownDatetimeField.php +++ b/src/Forms/DropdownDatetimeField.php @@ -43,8 +43,15 @@ public function frontendToInternal($value) { return null; } - $time = $value['time']; - $hours = ($time['Period'] == 'AM') ? $time['Hours'] : $time['Hours'] + 12; + $time = $value['time']; + $hours = ''; + + if ($time['Hours'] == 12) { + $hours = $time['Period'] == 'AM' ? '00' : '12'; + } else { + $hours = ($time['Period'] == 'AM') ? $time['Hours'] : $time['Hours'] + 12; + } + $dateTime->setTime((int)$hours, (int)$time['Mins']);