function date_field_all_day in Date 7.2
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 date.module \date_field_all_day()
Duplicate of what is now date_all_day_field() in the Date All Day module.
Left here to avoid breaking other modules that use this function.
DEPRECATED! Will be removed at some time in the future.
File
- ./
date.module, line 771
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;
}
elseif (empty($instance['settings']['widget']['settings']['display_all_day'])) {
return FALSE;
}
if (empty($date2)) {
$date2 = $date1;
}
// Use central logic for determining the granularity.
$granularity = date_granularity_precision($field['settings']['granularity']);
// The increment is 1 by default, but it can be overridden.
$increment = 1;
if (isset($instance['widget']['settings']['increment'])) {
$increment = $instance['widget']['settings']['increment'];
}
return date_is_all_day(date_format($date1, DATE_FORMAT_DATETIME), date_format($date2, DATE_FORMAT_DATETIME), $granularity, $increment);
}