You are here

private function Carbon::nextOrPreviousDay in Persian Date for Drupal 8 8.4

Go forward or backward to the next week- or weekend-day.

Parameters

bool $weekday:

bool $forward:

Return value

$this

4 calls to Carbon::nextOrPreviousDay()
Carbon::nextWeekday in src/Library/Carbon/Carbon.php
Go forward to the next weekday.
Carbon::nextWeekendDay in src/Library/Carbon/Carbon.php
Go forward to the next weekend day.
Carbon::previousWeekday in src/Library/Carbon/Carbon.php
Go backward to the previous weekday.
Carbon::previousWeekendDay in src/Library/Carbon/Carbon.php
Go backward to the previous weekend day.

File

src/Library/Carbon/Carbon.php, line 3063

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

private function nextOrPreviousDay($weekday = true, $forward = true) {
  $step = $forward ? 1 : -1;
  do {
    $this
      ->addDay($step);
  } while ($weekday ? $this
    ->isWeekend() : $this
    ->isWeekday());
  return $this;
}