From 8101b0e8fa4c45fc0f7e02e46cf1d0c0ade17e16 Mon Sep 17 00:00:00 2001 From: Tim Nagel Date: Tue, 13 Mar 2018 10:27:08 +1100 Subject: [PATCH] Return null for empty IntervalSpec --- Date/IntervalFormatter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Date/IntervalFormatter.php b/Date/IntervalFormatter.php index 1ff451b..2df2a1a 100644 --- a/Date/IntervalFormatter.php +++ b/Date/IntervalFormatter.php @@ -50,6 +50,10 @@ public static function formatDateInterval(\DateInterval $interval) $spec .= $interval->s . 'S'; } } + + if ($spec === 'P') { + return null; + } return $spec; }