Exemplo n.º 1
0
 public function getNextDate()
 {
     $date = $this->getDate();
     if ($date->isToday()) {
         return;
     }
     $endDate = $this->obj('EndDate');
     if ($date->format('Y') > $endDate->format('Y') || $date->format('n') > $endDate->format('n') || $date->format('j') >= $endDate->format('j')) {
         return;
     }
     $nextDate = new SS_DateTime('NextDate');
     $nextDate->setValue($date->getValue());
     do {
         $nextDate->setValue($nextDate->next_day($nextDate->format('Y'), $nextDate->format('n'), $nextDate->format('j')));
     } while ($nextDate->format('N') >= 6);
     // Skip past weekends.
     // If, after we skipped the weekend, we've shot past the current day or the end of sprint,
     // then return.
     if ($nextDate->inFuture()) {
         return;
     }
     if ($nextDate->format('Y') > $endDate->format('Y') || $nextDate->format('n') > $endDate->format('n') || $nextDate->format('j') > $endDate->format('j')) {
         return;
     }
     return $nextDate;
 }