1.20.x date.inc | date_range_valid($string) |
Tests validity of a date range string.
Parameters
string $string: A min and max year string like '-3:+1'a.
Return value
bool: TRUE if the date range is valid, FALSE otherwise.
File
- includes/
date.inc, line 1425 - Date API functions and constants.
Code
function date_range_valid($string) {
$matches = preg_match('@^([\+\-][0-9]+|[0-9]{4}):([\+\-][0-9]+|[0-9]{4})$@', $string);
return $matches < 1 ? FALSE : TRUE;
}