예제 #1
0
파일: Day.php 프로젝트: devhelp/calendar
 /**
  * Returns Day that is after given offset (calculated for given year)
  * @param string $offset
  * @param integer $year
  * @return Day
  */
 public function modify($offset, $year)
 {
     $dt = $this->toDateTime($year);
     $dt->modify($offset);
     return Day::fromDateTime($dt);
 }
예제 #2
0
 /**
  * Returns referenced day from the calendar
  * @param Calendar $calendar calendar in which day has to be looked
  * @param integer $year year for which the day has to be calculated
  * @return null|Day
  */
 public function getReferencedDay(Calendar $calendar, $year = null)
 {
     $day = $calendar->getDay($this->getEvent(), $year);
     if (!$day) {
         return null;
     }
     if ($this->getOffsetValue() === 0) {
         $referencedDay = $day;
     } else {
         $dt = $day->toDateTime($year);
         $dt->modify($this->getOffsetString());
         $referencedDay = Day::fromDateTime($dt);
     }
     return $referencedDay;
 }