diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-20 14:46:05 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-20 14:46:05 +0100 |
commit | be368a82f789aaa9f0ac0c8b6fa72a2f7cd0b6d4 (patch) | |
tree | 43a29bbea1b145cf92ada0efe49f19b8fcbcd273 /system/libraries/Calendar.php | |
parent | ca39f2efb2d827d13e4065535355de894965435a (diff) |
Date helper days_in_month(), CI_Calendar::get_total_days() changes
- days_in_month() now uses cal_days_in_month(), if available.
- CI_Calendar::get_total_days() is now an alias for days_in_month().
Diffstat (limited to 'system/libraries/Calendar.php')
-rw-r--r-- | system/libraries/Calendar.php | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 23c389e4b..7bdcdca09 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -456,23 +456,8 @@ class CI_Calendar { */ public function get_total_days($month, $year) { - $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - - if ($month < 1 OR $month > 12) - { - return 0; - } - - // Is the year a leap year? - if ($month == 2) - { - if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) - { - return 29; - } - } - - return $days_in_month[$month - 1]; + $this->load->helper('date'); + return days_in_month($month, $year); } // -------------------------------------------------------------------- |