Пример #1
0
 /**
  * Returns the highest LocalDate among the given values.
  *
  * @param LocalDate ... $dates The LocalDate objects to compare.
  *
  * @return LocalDate The latest LocalDate object.
  *
  * @throws DateTimeException If the array is empty.
  */
 public static function maxOf(LocalDate ...$dates)
 {
     if (!$dates) {
         throw new DateTimeException(__METHOD__ . ' does not accept less than 1 parameter.');
     }
     $max = LocalDate::min();
     foreach ($dates as $time) {
         if ($time->isAfter($max)) {
             $max = $time;
         }
     }
     return $max;
 }
Пример #2
0
 /**
  * Returns the smallest possible value for LocalDateTime.
  *
  * @return LocalDateTime
  */
 public static function min()
 {
     return new LocalDateTime(LocalDate::min(), LocalTime::min());
 }
Пример #3
0
 public function testMin()
 {
     $this->assertLocalDateIs(Year::MIN_VALUE, 1, 1, LocalDate::min());
 }