You are here

function cmfcCalendarV1Thai::isDateValid in Calendar Systems 8.2

Same name and namespace in other branches
  1. 8 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::isDateValid()
  2. 6 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::isDateValid()
  3. 7 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::isDateValid()
  4. 7.2 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::isDateValid()

Overrides cmfcCalendarV1Plugin::isDateValid

File

calendar/v1/calendarSystems/thai.class.inc.php, line 175

Class

cmfcCalendarV1Thai

Code

function isDateValid($month, $day, $year) {
  $month = (int) $month;
  $day = (int) $day;
  $year = (int) $year - 543;
  $timestamp = parent::mktime(10, 10, 10, $month, $day, $year);
  if ($month < 1 || $month > 12) {
    return FALSE;
  }
  if ($year < 1970 || $year > date('Y', $timestamp)) {
    return FALSE;
  }
  if ($day < 1 || $day > date('t', $timestamp)) {
    return FALSE;
  }
  return TRUE;
}