/** * check if this date/time a range or equal to the end dates */ public function isWithinOrEqual(A_Datetime_Range $range) { return $this->getTimestamp() >= $range->getStart() && $this->getTimestamp() <= $range->getEnd(); }
/** * Checks whether or not the given Range object intersects this range * * @param A_Datetime_Range $range Range object to check * @return bool */ public function intersects($range) { if (!$range || $this->end->getTimestamp() < $range->getStart()->getTimestamp() || $range->getEnd()->getTimestamp() < $this->start->getTimestamp()) { return false; } return true; }
function testConstructFromStartAndEnd() { $range = new A_Datetime_Range($this->start, $this->end); $this->assertEqual($range->getStart(), $this->start); $this->assertEqual($range->getEnd(), $this->end); }