function date_select_input_value in Date 5.2
Same name and namespace in other branches
- 6.2 date_api_elements.inc \date_select_input_value()
- 6 date_api_elements.inc \date_select_input_value()
Helper function for extracting a date value out of user input.
1 call to date_select_input_value()
- date_select_validate in ./
date_api_elements.inc - Validation function for date selector.
1 string reference to 'date_select_input_value'
- date_input_value in date/
date.module
File
- ./
date_api_elements.inc, line 489 - Date API elements themes and validation. This file is only included during the edit process to reduce memory usage.
Code
function date_select_input_value($element) {
$granularity = date_format_order($element['#date_format']);
if (date_is_valid($element['#value'], DATE_ARRAY, $granularity)) {
// Use fuzzy_datetime here to be sure year-only dates
// aren't inadvertantly shifted to the wrong year by trying
// to save '2009-00-00 00:00:00'.
return date_fuzzy_datetime(date_convert($element['#value'], DATE_ARRAY, DATE_DATETIME));
}
return NULL;
}