1 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
- core/
includes/ date.inc, line 1427 - Date API functions.
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;
}