You are here

function date_entity_metadata_duration_getter in Date 7.2

Same name and namespace in other branches
  1. 7.3 date.module \date_entity_metadata_duration_getter()
  2. 7 date.module \date_entity_metadata_duration_getter()

Getter callback to return the duration of the time period given by the dates.

1 string reference to 'date_entity_metadata_duration_getter'
date_entity_metadata_property_info_alter in ./date.module
Callback to alter the property info of date fields.

File

./date.module, line 692

Code

function date_entity_metadata_duration_getter($item, array $options, $name, $type, $info) {
  $value = date_entity_metadata_struct_getter($item, $options, 'value', 'struct', $info);
  $value2 = date_entity_metadata_struct_getter($item, $options, 'value2', 'struct', $info);
  if ($value && $value2) {
    return $value2 - $value;
  }
}