public function Carbon::closest in Persian Date for Drupal 8 8.4
Get the closest date from the instance.
Parameters
Carbon $dt1:
Carbon $dt2:
Return value
static
File
- src/
Library/ Carbon/ Carbon.php, line 1587
Class
- Carbon
- A simple API extension for DateTime
Namespace
Drupal\persian_date\Library\CarbonCode
public function closest(Carbon $dt1, Carbon $dt2) {
return $this
->diffInSeconds($dt1) < $this
->diffInSeconds($dt2) ? $dt1 : $dt2;
}