示例#1
0
 /**
  * @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;
 }
示例#2
0
 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;
 }