No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
b989a73
... +0 ...
b39a765
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
217 | 217 | */ |
|
218 | 218 | public function diffInDays($date = null, $absolute = true) |
|
219 | 219 | { |
|
220 | - | return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%a'); |
|
220 | + | return $this->getIntervalDayDiff($this->diff($this->resolveCarbon($date), $absolute)); |
|
221 | 221 | } |
|
222 | 222 | ||
223 | 223 | /** |
518 | 518 | return $hoursDiff / static::HOURS_PER_DAY; |
|
519 | 519 | } |
|
520 | 520 | ||
521 | - | $daysDiff = (int) $interval->format('%r%a'); |
|
521 | + | $daysDiff = $this->getIntervalDayDiff($interval); |
|
522 | 522 | ||
523 | 523 | return $daysDiff + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY; |
|
524 | 524 | } |
1149 | 1149 | ||
1150 | 1150 | return $this->isoFormat((string) $format); |
|
1151 | 1151 | } |
|
1152 | + | ||
1153 | + | private function getIntervalDayDiff(DateInterval $interval): int |
|
1154 | + | { |
|
1155 | + | $daysDiff = (int) $interval->format('%a'); |
|
1156 | + | $sign = $interval->format('%r') === '-' ? -1 : 1; |
|
1157 | + | ||
1158 | + | if (is_int($interval->days) && |
|
1159 | + | $interval->y === 0 && |
|
1160 | + | $interval->m === 0 && |
|
1161 | + | version_compare(PHP_VERSION, '8.1.0-dev', '<') && |
|
1162 | + | abs($interval->d - $daysDiff) === 1 |
|
1163 | + | ) { |
|
1164 | + | $daysDiff = abs($interval->d); |
|
1165 | + | } |
|
1166 | + | ||
1167 | + | return $daysDiff * $sign; |
|
1168 | + | } |
|
1152 | 1169 | } |
Files | Complexity | Coverage |
---|---|---|
src/Carbon | ø | 100.00% |
Project Totals (886 files) | 2171 | 100.00% |
b39a765
b989a73