dogma icon indicating copy to clipboard operation
dogma copied to clipboard

DateTimeIntervalSet::normalize() not always normalize fully

Open VladaHejda opened this issue 1 year ago • 1 comments

DateTimeIntervalSet::normalize() not always normalize fully:

		use Dogma\Time\DateTime;
		use Dogma\Time\Interval\DateTimeInterval;
		use Dogma\Time\Interval\DateTimeIntervalSet;

		$i1 = new DateTimeInterval(new DateTime('2024-09-01'), new DateTime('2024-09-10'));
		$i2 = new DateTimeInterval(new DateTime('2024-08-01'), new DateTime('2024-08-10'));
		$i3 = new DateTimeInterval(new DateTime('2024-07-20'), new DateTime('2024-09-02'));

		$s = new DateTimeIntervalSet([$i1, $i2, $i3]);
		var_dump(count($s->getIntervals())); // 3

		$s = $s->normalize();
		var_dump(count($s->getIntervals())); // 2

		$s = $s->normalize();
		var_dump(count($s->getIntervals())); // 1

VladaHejda avatar Jun 27 '24 11:06 VladaHejda

144b62b454ac54f0df28b8c2d44e69d119669336 solves

VladaHejda avatar Aug 05 '24 12:08 VladaHejda