You are here

function _calendar_jalali_check in Calendar Systems 6.2

Helper function to check whether the combination of passed values are in Jalali calendar range or not.

Parameters

$year: Jalali year.

$month: Jalali month.

$day: Jalali day.

Return value

Boolean value.

1 call to _calendar_jalali_check()
calendar_jalali_formatter in calendars/calendar_jalali/calendar_jalali.module
Jalali calendar date formatter callback.

File

calendars/calendar_jalali/calendar_jalali.module, line 411
Implements necessary hooks & helpers to support Jalali Calendar.

Code

function _calendar_jalali_check($year, $month, $day) {
  $jmonth_days = calendar_jalali_month_days();
  if ($year < 0 || $year > 32767 || $month < 1 || $month > 12 || $day < 1) {
    return FALSE;
  }
  if ($day > $jmonth_days[$month - 1] + ($month == 12 && !(($year - 979) % 33 % 4))) {
    return FALSE;
  }
  return TRUE;
}