You are here

public static function DateRecurUtility::createSmallestDateFromInput in Recurring Dates Field 3.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurUtility.php \Drupal\date_recur\DateRecurUtility::createSmallestDateFromInput()
  2. 3.0.x src/DateRecurUtility.php \Drupal\date_recur\DateRecurUtility::createSmallestDateFromInput()
  3. 3.1.x src/DateRecurUtility.php \Drupal\date_recur\DateRecurUtility::createSmallestDateFromInput()

Get the smallest date given a granularity and input.

Parameters

string $granularity: The granularity of the input.

string $value: User date input.

\DateTimeZone $timezone: The timezone of the input.

Return value

\DateTime A date time with the smallest value given granularity and input.

Throws

\InvalidArgumentException When date or granularity results in an invalid data object.

3 calls to DateRecurUtility::createSmallestDateFromInput()
DateRecurFilter::validateExposed in src/Plugin/views/filter/DateRecurFilter.php
Validate the exposed handler form.
DateRecurFilter::validateValue in src/Plugin/views/filter/DateRecurFilter.php
Form field validator.
DateRecurUtilityTest::testSmallestDate in tests/src/Kernel/DateRecurUtilityTest.php
Tests smallest date utility.

File

src/DateRecurUtility.php, line 30

Class

DateRecurUtility
Provide standalone utilities.

Namespace

Drupal\date_recur

Code

public static function createSmallestDateFromInput(string $granularity, string $value, \DateTimeZone $timezone) : \DateTime {
  return static::createDateFromInput($granularity, $value, $timezone, 'start');
}