You are here

public function DatexJalali::fixMissingGranularities in Datex 7.2

Make up for missing granularities.

Neccessary to get proper result while converting a date with a missing granularity, Look at DatexCalendarInterface::fixGranularities for more info.

Overrides DatexCalendarIterface::fixMissingGranularities

File

datex_api/DatexJalali.inc, line 489
Jalali calendar for datex.

Class

DatexJalali
Jalali calendar for datex.

Code

public function fixMissingGranularities(array $granuls) {
  $offset = 0;
  if (!($granuls['hour'] || $granuls['minute'] || $granuls['second'])) {

    // 12 hours.
    $offset = 43200;
  }
  else {
    $offset = 0;
  }
  if (!($granuls['month'] || $granuls['day'])) {

    // 6 months.
    $offset += 16070400;
  }
  elseif (!$granuls['day']) {

    // 31 days.
    $offset += 2678400;
  }
  return $offset;
}