Open Bug 254443 Opened 20 years ago Updated 2 years ago

need to support calendars other than Gregorian

Categories

(Calendar :: General, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: jshin1987, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: intl)

Currently, only Gregorian calendar is supported, but in some parts of the world,
other calendars are used along with/instead of Gregorian calendar. For Chinese
and Korean, Chinese / Korean (because of the difference in the standard merdian
for China and Korea, they're slightly different) lunar calendar is necessary. 

For Islams, obviously Islamic calendar is needed. Hebrew needs Hebrew calendar.
 For Japanese, eras need to be supported. 

I guess MS Outlook supports all these. Recently I heard from a Korean user that
he can't give up MS Outlook because Korean lunar calendar is not supported in
Sunbird. 

FYI, ICU (International Component for Unicode?) has implementations for all of
these calendars.
I know the algorithms for the Jewish calendar, however it's not a high priority
because very few people even in Israel use it as their primary calendar.
Summary: need to support calendars other than Gregorian → need to support calendars other than Gregorian
wmCalendar may be of interest: http://sourceforge.net/projects/wmcalendar/

It has support for using Gregorian, Persian and Islamic calendars from the same
ics file.  Perhaps some of the algorithms it uses could be useful in the Mozilla
Calendar.  Its license is only GPL though, I don't know if that hurts things any.
http://icalshare.com/  has several calendars 
Blocks: 282734
ICU4C may be an open source starting place for calendars.  It is available in an
 MIT/X style license.  
http://www-306.ibm.com/software/globalization/icu/license.jsp

It doesn't seem to include the Chinese, or Persian (& Afghan), calendar yet,
though there is a Chinese calendar listed in ICU4J that might be converted.
http://icu.sourceforge.net/charts/comparison/
*** Bug 283910 has been marked as a duplicate of this bug. ***
QA Contact: gurganbl → general
(In reply to comment #1)
> I know the algorithms for the Jewish calendar, however it's not a high priority
> because very few people even in Israel use it as their primary calendar.

That's not accurate: people in Israel use Jewish calendar for memorials, holidays. etc. In my opinion it's very important.
Reassigning all automatically assigned bugs from Mostafa to nobody@m.o

Bugspam filter: TorontoMostafaMove
Assignee: mostafah → nobody
I'm willing to help fix this bug.  I'm Iranian, and as my primary interest, I'd like to see Iranian calendar (a.k.a Persian or Jalali calendar) supported in Sunbird, but I'm also ready to help develop an infrastructure for the rest of calendars being added as well.

Can someone point me in the right direction?  Some pointers on where to get started, etc.?

Thanks!
Sunbird's calDateTime uses the open source iCalendar library Libical to compute year, month, date, and time in timezone from native time (such as milliseconds since 1970-01-01 00:00 UTC), and to compute recurrence dates for iCalendar repeating events.  Libical's icaltime.c is currently Gregorian only, so icaltime.c would need to be replaced with a framework that can handle multiple calendar scales.

ICU is an open source library with many calendar scales [1], with a C version (and a Java version), and the license is compatible.  For a Persian(Jalaali)/Afghan calendar [2], adding to ICU4C might be a good start.  (I think Microsoft .NET already has a Persian calendar [3], so ICU is behind.  ICU already has Islamic(Hijri) and Hebrew calendars [1], so it clearly can accomodate non-Gregorian calendar scales.)

For monthly or yearly repeating events to work in Sunbird/Lightning with non-gregorian calendar scales seems to require something like the following:
0. Extend ICU4C [1] if needed (such as to add Persian(Jalaali)/Afghan calendar)
1. Modify/fork Libical [4] to use ICU4C instead of icaltime.c (which is gregorian only).
2. Make Libical recognize/write CALSCALE [5]
3. Modify Sunbird/Lightning's calDateTime [6] to work with modified Libical and add calScale attribute.

[One issue is that the iCalendar spec (RFC2445) currently specifies that a calendar scale (CALSCALE [5]) applies to a whole calendar, not to individual events, so you would not be able to exchange events that repeat according different calendar scales in the same iCalendar ics file, or cut and paste, or drag and drop iCalendar data.  One approach might be to extend the iCalendar spec to also be able to specify a CALSCALE as a parameter on dates (like timezone parameter), and extend Libical to be able to read and write dates with that parameter, and extend calDateTime to include a calScale attribute.]

To display dates, Sunbird uses the current operating system locale format.

To choose dates, Sunbird uses its own datepicker, which is currently based on the Javascript Date object, which is gregorian only.  There has been suggestions to make a date and time pickers extensible so they could use either a javascript date (which doesn't handle timezones) or a calDateTime (that can handle timezones) (bug 92174 comment 47).  If calDateTime also handled different calendar scales, then the calDateTime version of the datepicker might be made to work (as long as the locale information is available for the correct month names for that calendar scale).   Might need to extend UI so user can select which calendar scale.

Recurrence patterns are specified in a subdialog of the calendar-event-dialog.  Test to make sure monthly options still work correctly with different month lengths, and with 13th month for calendar scales that have it.

(If you (or a team) decide to take on this large project, you might want to start a wiki.mozilla.org page on it to record your proposed plans and progress, especially since some of the work is in libraries outside Mozilla.)

[Note: These are thoughts on what it would take to implement.  I cannot say what it would take for the Mozilla Calendar project to accept these changes.  For example, Mozilla uses its trademarks as marks of its quality-testing.
Maybe each new calendar scale needs to have a well-checked test-suite to enable others, such as the ICU project, to vouch for its correctness.]

References:

[1] ICU comparison table indicates ICU4C has Islamic(Hijri) and Hebrew calendar scales, not Persian(Jalaali)/Afghan yet
(scroll to "Date/Time Services")
http://icu.sourceforge.net/charts/comparison/

[2] Persian calendar is used in Afghanistan as well as Iran, though with different month names.
http://en.wikipedia.org/wiki/Iranian_Calendar

[3] Microsoft .NET has PersianCalendar
http://msdn2.microsoft.com/en-us/library/system.globalization.persiancalendar.aspx

[4] Libical is SourceForge "FreeAssociation" project
http://www.softwarestudio.org/libical/
http://sourceforge.net/projects/freeassociation/

[5] RFC2445 iCalendar CALSCALE
http://rfc.net/rfc2445.html#s4.7.1

[6] calIDateTime, calDateTime
http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIDateTime.idl
http://lxr.mozilla.org/mozilla/source/calendar/base/src/calDateTime.cpp
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.