Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Aug 17, 2022
2 parents 34510f0 + ca03fca commit 92490a0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/TwigExtension/ArcheTwigDateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ private function checkYearIsMoreThanFourDigit($value): bool
return false;
}

private function checkDateTimeValue($value) {
private function checkDateTimeValue($value)
{
$datetime = new \DateTime();
$newDate = $datetime->createFromFormat('Y-m-d', $value);
if($newDate) {
if ($newDate) {
return $newDate->format('Y-m-d H:i:s');
}
return $value;
Expand Down Expand Up @@ -103,15 +104,15 @@ private function notNormalDate($value, $lang, $dateformat): string
case 'd-m-Y':
return $m.'-'.$d.'-'.$y;
case 'd-m-y':
return $m.'-'.$d.'-'.$y;
return $m.'-'.$d.'-'.$y;
case 'd M Y':
return $d.'-'.date('M', $m).'-'.$y;
case 'd M y':
return $d.'-'.date('M', $m).'-'.$y;
return $d.'-'.date('M', $m).'-'.$y;
case 'Y M d':
return $y.'-'.date('M', $m).'-'.$d;
case 'y M d':
return $y.'-'.date('M', $m).'-'.$d;
return $y.'-'.date('M', $m).'-'.$d;
default:
return $y.'-'.$m.'-'.$d;
}
Expand Down

0 comments on commit 92490a0

Please sign in to comment.