8000 Fixed bug #52015: Allow including end date in DatePeriod iterations by derickr · Pull Request #8550 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

Fixed bug #52015: Allow including end date in DatePeriod iterations #8550

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

Merged
merged 3 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add extra test case that hase both EXCLUDE_START_DATE and INCLUDE_END…
…_DATE
  • Loading branch information
derickr committed May 20, 2022
commit 1af354a659202d3eb8c7b6fe1bd7b2265329c4aa
19 changes: 19 additions & 0 deletions ext/date/tests/date_period_exclude_start_and_include_end.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
DatePeriod::EXCLUDE_START_DATE|DatePeriod::INCLUDE_END_DATE
--FILE--
<?php
date_default_timezone_set('UTC');
$start = new DateTime('2010-06-07');
$end = new DateTime('2010-06-10');
$interval = new DateInterval('P1D');

$dp = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE | DatePeriod::INCLUDE_END_DATE);
foreach ($dp as $day) {
echo $day->format('Y-m-d') . "\n";
}
?>
--EXPECT--
2010-06-08
2010-06-09
2010-06-10

0