Commit d5d78095 authored by alexpott's avatar alexpott
Browse files

Issue #2504211 by mpdonadio: DateFormatter::formatDiff() ignore granularity in some circumstances

parent 65312647
...@@ -401,7 +401,7 @@ public function formatDiff($from, $to, $options = array()) { ...@@ -401,7 +401,7 @@ public function formatDiff($from, $to, $options = array()) {
$granularity--; $granularity--;
} }
if ($granularity == 0) { if ($granularity <= 0) {
break; break;
} }
} }
......
...@@ -376,6 +376,9 @@ public function providerTestFormatDiff() { ...@@ -376,6 +376,9 @@ public function providerTestFormatDiff() {
// Checks the non-strict option vs. strict (default). // Checks the non-strict option vs. strict (default).
array('1 second', $this->createTimestamp('2013-12-11 10:09:08'), $this->createTimestamp('2013-12-11 10:09:07'), $non_strict), array('1 second', $this->createTimestamp('2013-12-11 10:09:08'), $this->createTimestamp('2013-12-11 10:09:07'), $non_strict),
array('0 seconds', $this->createTimestamp('2013-12-11 10:09:08'), $this->createTimestamp('2013-12-11 10:09:07')), array('0 seconds', $this->createTimestamp('2013-12-11 10:09:08'), $this->createTimestamp('2013-12-11 10:09:07')),
// Checks granularity limit.
array('2 years 3 months 1 week', $this->createTimestamp('2011-08-30 11:15:57'), $request_time, $granularity_3),
); );
return $data; return $data;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment