You are here

public function DateObject::limitGranularity in Date 7

Same name and namespace in other branches
  1. 7.3 date_api/date_api.module \DateObject::limitGranularity()
  2. 7.2 date_api/date_api.module \DateObject::limitGranularity()

In common usage we should not unset timezone through this.

File

date_api/date_api.module, line 313
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

Class

DateObject
Extend PHP DateTime class with granularity handling, merge functionality and slightly more flexible initialization parameters.

Code

public function limitGranularity($gran) {
  foreach ($this->granularity as $key => $val) {
    if ($val != 'timezone' && !in_array($val, $gran)) {
      unset($this->granularity[$key]);
    }
  }
}