You are here

public static function DatexDateList::datetimeRangeYears in Datex 8

Specifies the start and end year to use as a date range.

Handles a string like -3:+3 or 2001:2010 to describe a dynamic range of minimum and maximum years to use in a date selector.

Centers the range around the current year, if any, but expands it far enough so it will pick up the year value in the field in case the value in the field is outside the initial range.

Parameters

string $string: A min and max year string like '-3:+1' or '2000:2010' or '2000:+3'.

object $date: (optional) A date object to test as a default value. Defaults to NULL.

Return value

array A numerically indexed array, containing the minimum and maximum year described by this pattern.

Overrides DateElementBase::datetimeRangeYears

File

src/Element/DatexDateList.php, line 237

Class

DatexDateList
Plugin annotation @FormElement("datelist");

Namespace

Drupal\datex\Element

Code

public static function datetimeRangeYears($string, $date = NULL) {
  return static::datexDatetimeRangeYears($string, $date);
}