Skip to content

Commit 03208c1

Browse files
authored
Merge pull request #446 from cakephp/fix-445
Fix off by one errors in diffFiltered
2 parents 96f28dd + cdbb22d commit 03208c1

2 files changed

Lines changed: 462 additions & 7 deletions

File tree

src/Traits/DifferenceTrait.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,10 @@ public function diffFiltered(
182182
$end = $this;
183183
$inverse = true;
184184
}
185-
// Hack around DatePeriod not including end values.
186-
// When handling dates we need to convert to a DateTime
187-
// and offset by 1 second.
188-
if ($end instanceof ChronosDate) {
189-
$end = (new Chronos($end))->modify('+1 second');
190-
}
191185

192186
$period = new DatePeriod($start, $ci, $end);
193187
$vals = array_filter(iterator_to_array($period), function (DateTimeInterface $date) use ($callback) {
194-
return $callback(static::instance($date));
188+
return $callback(static::parse($date));
195189
});
196190

197191
$diff = count($vals);

0 commit comments

Comments
 (0)