Month includes doesn't work properly
marianperca opened this issue · 2 comments
marianperca commented
For year 2012 and month 12, day 31 in not included in the month.
If I'll make this check, it will return false:
$month->includes($day); // where $day is 2012-12-31
In your code you have the following:
public function includes(PeriodInterface $period, $strict = true)
{
if (true === $strict) {
return
$this->contains($period->getBegin()) &&
$this->contains($period->getEnd());
}
...
This check $this->contains($period->getBegin()) will return TRUE, but this one will return FALSE: $this->contains($period->getEnd()). This is because ->getEnd() returns the next day.
CalendR\Period\Day('begin'=>DateTime('date'=>'2012-12-31 00:00:00', 'timezone_type'=> 3, 'timezone'=> ... ), 'end'=>DateTime('date'=>'2013-01-01 00:00:00', 'timezone_type'=> 3, 'timezone'=> ... ))
yohang commented
I'll check at it.
marianperca commented
Thanks!