Skip to content

Commit

Permalink
Allow an optional Clock parameter in ZonedDateTime::isPast() and isFu…
Browse files Browse the repository at this point in the history
…ture()
  • Loading branch information
BenMorel committed Oct 4, 2017
1 parent fc09a3f commit 549b60f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/ZonedDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,23 +822,31 @@ public function isBetweenExclusive(ZonedDateTime $from, ZonedDateTime $to) : boo
}

/**
* Returns whether this ZonedDateTime is in the future.
* Returns whether this ZonedDateTime is in the future, according to the given clock.
*
* @return boolean
* If no clock is provided, the system clock is used.
*
* @param Clock|null $clock
*
* @return bool
*/
public function isFuture()
public function isFuture(Clock $clock = null) : bool
{
return $this->getInstant()->isFuture();
return $this->getInstant()->isFuture($clock);
}

/**
* Returns whether this ZonedDateTime is in the past.
* Returns whether this ZonedDateTime is in the past, according to the given clock.
*
* @return boolean
* If no clock is provided, the system clock is used.
*
* @param Clock|null $clock
*
* @return bool
*/
public function isPast()
public function isPast(Clock $clock = null) : bool
{
return $this->getInstant()->isPast();
return $this->getInstant()->isPast($clock);
}

/**
Expand Down

0 comments on commit 549b60f

Please sign in to comment.