Jalali (Hijri Shamsi, or Solaro Hijri) is the calendar used in Iran and Afghanistan. It shares the same epoch (start date, Hijra) with the (Lunar) Hijri calendar which is available in Libreoffice as i18npool/source/calendar/calendar_hijri.cxx. The difference is that the Jalali calendar uses solar years. An introduction to Jalali calendar can be found here: Solar Hijri calendar https://en.wikipedia.org/wiki/Solar_Hijri_calendar Currently, people may use a macro to be able to use Jalali Calendar, but it has its own shortcomings: Persian or Jalali Calndar for Calc https://extensions.libreoffice.org/en/extensions/show/5709 A good FOSS implementation of Jalali calendar is available in C programming language without extra dependencies: https://github.com/ashkang/jcal/ It has been used in Ubuntu, Debian and elsewhere: https://packages.ubuntu.com/bionic/utils/jcal https://packages.debian.org/sid/jcal
Note that *only* the libjalali sources https://github.com/ashkang/jcal/tree/master/sources/libjalali are licensed LGPLv3+ and could be used as external module, jcal itself is GPLv3+ and as such can not be incorporated into LibreOffice source code. The library is available in Debian as https://packages.debian.org/sid/libjalali0 and in Fedora as https://packages.fedoraproject.org/pkgs/jcal/libjalali/ Original upstream appears to be https://savannah.nongnu.org/projects/jcal/
It would be good to have support for Persian calendar in LibreOffice.
First of all, we need some clarity here. Several terms seem mixed, creating confusion and a way to mistakes: Jalali and Hijri Shamsi, which are *different* calendars, the former being a non-algorithmic one, defined by ongoing astronomical observations. The latter one is said to use 33 (sometimes 29) year cycles, also requiring periodical synchronization using astronomical data. But the libjalali, mentioned further, is implemented using 2820 years cycle [1], which is "Birashk leap year algorithm" [2], said to be an *alternative* computation method suggested in early XX century, and to be much less precise than both Jalali and Hijri. The existence of the library in the distro repos sais nothing about its usage to implement system calendar using it. Is it actually used for the purpose? And more importantly - does it match what Excel implemented? We likely need a spreadsheet from Excel with important dates for very large period helping make sure we do it properly. [1] https://git.savannah.nongnu.org/cgit/jcal.git/tree/sources/libjalali/jalali.c#n54 [2] https://en.wikipedia.org/wiki/Solar_Hijri_calendar#Birashk_leap_year_algorithm
(In reply to Mike Kaganski from comment #3) > "Birashk leap year algorithm" [2], said > to be an *alternative* computation method suggested in early XX century, and > to be much less precise than both Jalali and Hijri. Indeed, not "early" but "late"; let me quote some Wikipedia: > Some predictive algorithms had been suggested, but were inaccurate due to > confusion between the average tropical year (365.2422 days) and the mean > interval between spring equinoxes (365.2424 days). These algorithms are not > generally used (see Accuracy). > ... > Iranian mathematician Ahmad Birashk (1907–2002) proposed an alternative means > of determining leap years. Birashk's book came out in 1993, and his algorithm > was based on the same apparently erroneous presumptions as used by Zabih > Behruz in his book from 1952. > ... > The accuracy of the system proposed by Birashk and other recent authors, such > as Zabih Behruz, has been thoroughly refuted and shown to be less precise than > the traditional 33-year cycle.