You are here

private static function CarbonInterval::wasCreatedFromDiff in Persian Date for Drupal 8 8.4

Determine if the interval was created via DateTime:diff() or not.

Parameters

DateInterval $interval:

Return value

bool

2 calls to CarbonInterval::wasCreatedFromDiff()
CarbonInterval::add in src/Library/Carbon/CarbonInterval.php
Add the passed interval to the current instance
CarbonInterval::instance in src/Library/Carbon/CarbonInterval.php
Create a CarbonInterval instance from a DateInterval one. Can not instance DateInterval objects created from DateTime::diff() as you can't externally set the $days field.

File

src/Library/Carbon/CarbonInterval.php, line 100

Class

CarbonInterval
A simple API extension for DateInterval. The implementation provides helpers to handle weeks but only days are saved. Weeks are calculated based on the total days of the current instance.

Namespace

Drupal\persian_date\Library\Carbon

Code

private static function wasCreatedFromDiff(DateInterval $interval) {
  return $interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE;
}