You are here

function date_entity_metadata_duration_getter in Date 7

Same name and namespace in other branches
  1. 7.3 date.module \date_entity_metadata_duration_getter()
  2. 7.2 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 621

Code

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