/** * # Example: * * This: □□□□□□■■■■■■■■■■■■□□□□□□□□□□□□□□□□□□□□□□□□□□□ * Other: □□□□□□□□□□□□□□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□□□ * 23:59:59 >< 00:00:00 * * @param DateTimeInterval $other * @return bool */ public function isFollowedByAtMidnight(DateTimeInterval $other) : bool { return IntervalUtils::isSameDate($this->getRight()->getValue(), $other->getLeft()->getValue()->modifyClone('-1 day')) && $this->getRight()->getValue()->format('H:i:s') === '23:59:59' && $other->getLeft()->getValue()->format('H:i:s') === '00:00:00'; }
/** * @inheritdoc */ public function format(DateTimeInterval $value) { $leftValue = $this->dateTimeConverter->format($value->getLeft()->getValue()); $rightValue = $this->dateTimeConverter->format($value->getRight()->getValue()); return sprintf($this->format, $leftValue, $rightValue); }