You are here

function partial_date_reduce_range_values in Partial Date 7

1 call to partial_date_reduce_range_values()
partial_date_render_range in ./partial_date.module

File

./partial_date.module, line 836
Defines a date element that allows for any combination of date granularity settings.

Code

function partial_date_reduce_range_values(&$from, &$to) {

  // Reduce dates on granularity values.
  foreach (array_keys(partial_date_components()) as $key) {

    // Excat match as we need to compare '' to 0.
    if (!isset($from[$key]) && !isset($to[$key])) {
      continue;
    }
    elseif (isset($from[$key]) || !isset($to[$key]) || $from[$key] !== $to[$key]) {
      break;
    }
    $from[$key] = NULL;
  }
}