Apache OpenOffice (AOO) Bugzilla – Issue 42452
hijri Date Number Format miscalculates
Last modified: 2013-08-07 15:12:27 UTC
When converting DAte into hijri format, the formate miscalculates. e.g. 16/7/622 schould return 1/1/1 hijri but it returns 2/1/1 This miscalculation continues until 2005. I might provide the right calculating algorithm and a table that allowa for comparision. Kind regards Shimshon Bar-Yehuda
Created attachment 22424 [details] File shows miscalculation
Hi Shimshon, There are two issues with the dates entered in the attached sample document: 1. Dates entered may not be correctly processed if they point before the Gregorian calendar reformation, which is 1582-10-15, as there are several different ways to calculate those, depending on what area you choose and when the reformation happened in that specific area. It may be that your table/tool chose a different approach than OOo. 2. AFAIK there are also different ways to calculate the Hijri calendar, I'm not sure if there even is _the_ one and only algorithm to do it. For example, also http://www.rabiah.com/convert/ mentions "There is a small probability of one day error", and in fact for the newer dates has one date offset from your "external calendar program", but gives identical results for older dates. That site, btw, delivers identical results as http://www.islamicfinder.org/Hcal/index.php. On the other hand, http://www.fourmilab.com/documents/calendar/ delivers identical results to yours. Could you please provide some pointers to what algorithm was used in your comparison? Thanks. Karl, As you implemented the calendars I assign this issue to you. Note that it is still unconfirmed and doesn't have a target set. Am I right in my previous assumptions about different algorithms, or is there a real miscalculation in our implementation? Is one of the other algorithms better than OOo's? Thanks Eike
Found a good explanation about the 1 day error in Hijri date calculation, taken from http://bennyhills.fortunecity.com/elfman/454/calindex.html#Error 1. The Same Gregorian date may have actually 2-4 Hijri equivalent dates according to the PLACE & TIME of the day. The 1st of Ramadan in Jordan for example could be the 30th of Shaban in some other parts of the world according to the sighting of the moon, also 1st of Ramada at an instance in San Francisco could be equivalent to the 2nd of Ramadan in China because of time zone difference. To add on top that, the Isalmic & Hebrew days begin at sunset, so the 1st of August before sunset & after sunset will correspond to 2 different Islamic & Hebrew days. 2. The conversion from & to the Hijri calendar is a pure mathematical one, & for the reasons of conversion, I had to make the Islamic day start at midnight. This is not true, but it makes conversion easier & wouldn't affect the +/-1 day error that much. In reality, the sighting of the moon is the basis of determining when the month starts. Islamic Astronomers have a fixed 30 year cycle which has the 2nd, 5th, 7th, 10th, 13th, 16th, 18th, 21st, 24th, 26th, and 29th years as leap years of 355 days, this however is not taken into consideration by many Islamic countries which consider the physical sighting of the moon as the only method of determining the beginning of a lunar month. You have to remember also that the Islamic day starts at sunset & ends on the next sunset ! But come now !!! Even with all of these errors, the total error is +/- 1 day, & even the most accurate of calculations will have the same error at the end(look at the paragraph above) !! That makes my converter reliable, especially if you knew that the method of determining the 1st day changes from one country to another, bringing any converter to making predictions, not more ! 3. The Gregorian calendar was implemented in 1582 CE in ROME, so dates before May, 1582 CE are calculated in reference to the first day the Gregorian calendar was implemented "Gregorian Proleptic Calendar." 4. Many countries adopted the Gregorian Calendar years after that date. So you see, some of the errors are out of my hand & some can be corrected! (see below). The transition between calendars gave the people the sense of losing days, although when referring to the proper calendar, not a single day was missed, but the problem was that no one referred to the proper calendar. 5. One way to be 100% sure about the Hijri conversion is to know FOR SURE the day of the week on which a certain Hijri date occurred, then you can correct the Gregorian day result to that day of the week (That is if the results didn't match ??!!), & remember to correct to the nearest day or then you will FOR SURE be 7 days off your mark.
1. I am well aware of the problems that arise from calculating Hijra-dates. 2. I do not think that there is any problem with dates before 1582-10-15, as far as you use this date and no other as was done in most protastant countries. 3. Pointers: I. http://www.oriold.unizh.ch//static/hegira.html. II. Nachum Dershowitz and Edward M. Reingold,Calendrical Calculations,in: Software-Practice and Experience, Vol 20(9)(1999), pp. 899-928. http://emr.cs.iit.edu/home/reingold/calendar-book/papers/calendar.ps (both yield the same values). 4. The start of the Hijra calendar should be 622-7-16, and no other date. 5. Orientalists are using the table by Wüstenfeld, Mahler: "Vergleichungs-Tabellen" (Wiesbaden, 1961). Paragraph 3 (both algorithms) and 4 yield the same values. This should be so, since the table by Wüstenfeld was just counted. If your program should calculate according to actual moon sighting, I can't add anything. As far as the Hebrew calander is concerned, I never experienced a problem and in reality. The fact that the Muslim/Jewish day starts at sunset does not make up for the 1-day difference.
ICU 3.2 contains Arabic and Hebrew calendar, we will use them instead of maintaining our own code when we upgrade icu for 2.0.1.
Since we have not decided when we will upgrade icu to 3.2 or latest, I re-target this issue to OOo Later.
CasY reports on IRC the leap yers are wrong " 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29" i wanna only change 16 to 15 in file i18npool/source/calendar/calendar_hijri.cxx
Hi Karl, If this one leap year change causes the one-day-off calculation, I suggest to include this minimal fix in OOo2.0.3 and not to wait for our ICU upgrade. Somehow I'm not convinced though that this is related, even if the change would be correct, or how would it explain the day off since the beginning of the calendar? Eike
According to the discussion here http://www.phys.uu.nl/~vgent/islam/islamyear_en.htm 16 is "most commonly used" while 15 is used by "Microsoft". The link provides a calculator that offers 8 different conversions for any given date. So I suppose my transmission of the request from CasY could have said the reporter "requires" or "prefers" 15, not that 16 "wrong". Hope that helps, I only wanted to pass on the from IRC.
"Emre whose nick name is CasY" wrote me a personal mail with some additional pointers. I asked him to add the information to this issue instead, but so far he didn't, so this is it: But you may create an algorithm with that books' perfect enlightenment: In http://www.hakikatkitabevi.com/download/download.htm#english 5-Endless Bliss Fifth Fascicle This book's link is http://www.hakikatkitabevi.com/download/english/05-EndlessBlis5.pdf The book's Calculation knowledge's parts are: * Endless Bliss Fifth Fascicle, Chapter 8: Conversion of the solar year into lunar year * Endless Bliss Fifth Fascicle, Chapter 9: Conversion of the lunar year into the Christian year * Endless Bliss Fifth Fascicle, Chapter 10: Finding the first day of Hegira year * Endless Bliss Fifth Fascicle, Chapter 11: Finding the first day of any Arabic month And also you can find a lot of information of this book and anothers from: http://www.hizmetbooks.org/
Hijri calendar is implemented by Bustamam who no longer works on this project. The suggested fix, changing leap yers array, will not work, since the array is not used in the program. Please provide patch for the issue.
Created attachment 73191
Comment on attachment 73191 Spam
Reset assignee on issues not touched by assignee in more than 1000 days.