summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/helpers/date_helper.php5
-rw-r--r--system/libraries/Calendar.php19
2 files changed, 7 insertions, 17 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 56e5c46aa..73fd8086e 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -278,6 +278,11 @@ if ( ! function_exists('days_in_month'))
$year = date('Y');
}
+ if (defined('CAL_GREGORIAN'))
+ {
+ return cal_days_in_month(CAL_GREGORIAN, $month, $year);
+ }
+
if ($year >= 1970)
{
return (int) date('t', mktime(12, 0, 0, $month, 1, $year));
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);
}
// --------------------------------------------------------------------