Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeIntervalSet::normalize() not always normalize fully #28

Open
VladaHejda opened this issue Jun 27, 2024 · 0 comments
Open

DateTimeIntervalSet::normalize() not always normalize fully #28

VladaHejda opened this issue Jun 27, 2024 · 0 comments

Comments

@VladaHejda
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant