4 Commits
Author SHA1 Message Date
dualfroz aeda5bd6bd fix: return 0 length for empty periods instead of a positive count
Period::length() derived its count from diff()->days (day precision) and
abs() (hour/minute/second precision), both of which discard sign
information. For a period whose boundary exclusions push includedStart()
past includedEnd() (e.g. a single-day period with Boundaries::EXCLUDE_ALL),
the period is empty and iterating it yields zero dates, yet length()
still reported a positive number, disagreeing with iterator_count().

Add an explicit emptiness check so length() returns 0 whenever
includedStart() is after includedEnd(), matching the iterator's behaviour
across all precisions.
2026-09-04 03:06:24 +02:00
upstream a0a637fda7 Upstream spatie/period state of the touched files before f717c7c624 2026-09-04 03:06:24 +02:00
dualfroz 67bae2d40e fix: return 0 length for empty periods instead of a positive count
Period::length() derived its count from diff()->days (day precision) and
abs() (hour/minute/second precision), both of which discard sign
information. For a period whose boundary exclusions push includedStart()
past includedEnd() (e.g. a single-day period with Boundaries::EXCLUDE_ALL),
the period is empty and iterating it yields zero dates, yet length()
still reported a positive number, disagreeing with iterator_count().

Add an explicit emptiness check so length() returns 0 whenever
includedStart() is after includedEnd(), matching the iterator's behaviour
across all precisions.
2026-09-06 00:58:50 +02:00
upstream dd39a1b841 Upstream spatie/period state of the touched files before fefbb86e53 2026-09-04 03:06:24 +02:00