fix bug when date interval for 1 day or multiple years

This commit is contained in:
Julien Fastré 2018-06-05 09:42:31 +02:00
parent d3d8f27c6d
commit f6f1b504bd

View File

@ -74,13 +74,15 @@ class NativeDateIntervalType extends DateIntervalType
if (is_numeric($current)) { if (is_numeric($current)) {
$next = \next($strings); $next = \next($strings);
switch($next) { switch($next) {
case 'year': case 'year':
case 'years':
$unit = 'Y'; $unit = 'Y';
break; break;
case 'mon': case 'mon':
case 'mons': case 'mons':
$unit = 'M'; $unit = 'M';
break; break;
case 'day':
case 'days': case 'days':
$unit = 'D'; $unit = 'D';
break; break;