public function dateNowOf(Clock $clock)
 {
     return $this->dateFrom(LocalDate::nowOf($clock));
 }
 /**
  * Obtains the current {@code ThaiBuddhistDate} from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current date - today.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@linkplain Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return ThaiBuddhistDate the current date, not null
  * @throws DateTimeException if the current date cannot be obtained
  */
 public static function nowOf(Clock $clock)
 {
     return new ThaiBuddhistDate(LocalDate::nowOf($clock));
 }
Beispiel #3
0
 /**
  * Obtains the current year from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current year.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@link Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return Year the current year, not null
  */
 public static function nowOf(Clock $clock)
 {
     $now = LocalDate::nowOf($clock);
     // called once
     return Year::of($now->getYear());
 }
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_now_Clock_tooLow()
 {
     $clock = Clock::fixed(self::MIN_INSTANT()->minusNanos(1), ZoneOffset::UTC());
     LocalDate::nowOf($clock);
 }
Beispiel #5
0
 /**
  * Obtains the current month-day from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current month-day.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@link Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return MonthDay the current month-day, not null
  */
 public static function nowOf(Clock $clock)
 {
     $now = LocalDate::nowOf($clock);
     // called once
     return MonthDay::ofMonth($now->getMonth(), $now->getDayOfMonth());
 }
Beispiel #6
0
 /**
  * Obtains the current {@code MinguoDate} from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current date - today.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@linkplain Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return MinguoDate the current date, not null
  * @throws DateTimeException if the current date cannot be obtained
  */
 public static function nowOf(Clock $clock)
 {
     return new MinguoDate(LocalDate::nowOf($clock));
 }