Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Derek Jones edited this page · 15 revisions
Clone this wiki locally

Category:Core | Category:Core::Community | Category:Core::Calendar

New calendar libraries make CodeIgniter multi-calendar capable with completely old code compatibility.


For developing international projects using CodeIgniter framework, beside language string support there is need of other calendars that is used on those countries specially in Asia.



There is a Multi_Calendar library in the heart of new calendar library. This class is a collection of functions and constants converted to PHP syntax from an already JS code mentions in PHP documentation, Calendar reference.

User can load it and use it to convert about 11 different calendars dates or check if it is Leap year in that calendar. This way users will have a complete calendar library for almost all existing calendar.

The old calendar library has been changed too. Now there will be Calendar_gregorian, Calendar_persian, ... classes that will implement the current calendar class for that particular calendar. The old one will call functions of extended classes and it will remain compatible with old codes.

It can make Codeigniter it richer without any much complexity or overhead in size,


Persian and Gregorian(no change from original calendar class) calendars have been prepared and others are in the way. CI_Calendar has been changed to call Gregorian(default) Persian, Hebrew, Arabic ... calendars. So this changes are completely compatible with old version of using Calendar (without any changes), just if anyone want to use other calendars it is possible not just by passing a "base_calendar" config parameter.

This way codeigniter may be the first framework to support multiple calendars (now it means truly a internationalization support).

The base JS codes are Public domain and new changes license will be GPL or it can be changed to fit in codeigniter license.

Here there is a libs and a sample controller to use them

This file contains:

  • Multi_Calendar.php: A new Multi_Calendar class to do calendar based calculations for many calendars like Gregorian, Persian, Hebrew, Arabic, French, ...

  • Calendar:Old calendar of CI which has been changed to use new multi-calendar architecture.

  • Calendar_Persian, Calendar_Gregorian: Two calendar implementation based on new form.

  • Blog:A sample controller.

[quote]/home/kaveh/calendar_kmz/: total 8 drwxr-xr-x 2 kaveh ashk 4096 2007-07-26 11:14 controller drwxr-xr-x 2 kaveh ashk 4096 2007-07-26 11:14 library

/home/kaveh/calendar_kmz/controller: total 4 -rw-r--r-- 1 kaveh ashk 411 2007-07-26 10:14 blog.php

/home/kaveh/calendar_kmz/library: total 92 -rw-r--r-- 1 kaveh ashk 13206 2007-07-25 22:31 Calendar_gregorian.php -rw-r--r-- 1 kaveh ashk 13439 2007-07-26 10:16 Calendar_persian.php -rw-r--r-- 1 kaveh ashk 3696 2007-07-25 22:00 Calendar.php -rw-r--r-- 1 kaveh ashk 50240 2007-07-24 16:24 Multi_calendar.php[/quote]


Default gregorian calendar ( The calendar that is common in most countries)

echo $this->calendar->generate();

Persian calendar

echo $this->calendar->generate();
Something went wrong with that request. Please try again.