Skip to content

Commit

Permalink
Merge pull request #1 from symbiote-library/fix-date-calc
Browse files Browse the repository at this point in the history
fix(DropdownDateField) issue with calculating AM/PM
  • Loading branch information
stephenmcm authored Mar 4, 2019
2 parents ef30993 + 69217de commit 1f967e9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Forms/DropdownDatetimeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down

0 comments on commit 1f967e9

Please sign in to comment.