/** * @param $date * @return HebrewDate */ public function getNextHebrewDate($date) { $hebrewDate = new HebrewDate(new DateTime($date)); $now = new HebrewDate(); while ($now->compare($hebrewDate) > 0) { $hebrewDate->addYear(); } return $hebrewDate; }
public function compare(HebrewDate $other) { if ($this->year != $other->getYear()) { return $this->year - $other->getYear(); } if ($this->getMonth() != $other->getMonth()) { return $this->getMonth() - $other->getMonth(); } if ($this->getDay() != $other->getDay()) { return $this->getDay() - $other->getDay(); } return 0; }