function date_field_all_day in Date 7
Same name and namespace in other branches
- 6.2 date/date.module \date_field_all_day()
- 7.3 date.module \date_field_all_day()
- 7.2 date.module \date_field_all_day()
Determine if a from/to date combination qualify as 'All day'.
Parameters
array $field, the field definition for this date field.:
object $date1, a date/time object for the 'from' date.:
object $date2, a date/time object for the 'to' date.:
Return value
TRUE or FALSE.
1 call to date_field_all_day()
- theme_date_all_day in ./
date.theme - Adjust from/to date format to account for 'all day' .
File
- ./
date.module, line 637
Code
function date_field_all_day($field, $instance, $date1, $date2 = NULL) {
if (empty($date1) || !is_object($date1)) {
return FALSE;
}
elseif (!date_has_time($field['settings']['granularity'])) {
return FALSE;
}
if (empty($date2)) {
$date2 = $date1;
}
$granularity = $field['settings']['granularity'];
$granularity = array_pop($granularity);
$increment = isset($instance['widget']['increment']) ? $instance['widget']['increment'] : 1;
return date_is_all_day(date_format($date1, DATE_FORMAT_DATETIME), date_format($date1, DATE_FORMAT_DATETIME), $granularity, $increment);
}