[Mono-dev] Hebrew Calendar

Atsushi Eno atsushi at ximian.com
Mon Mar 20 20:39:34 EST 2006


Hello Yaacov,

Oh, so simple fix - I'm unsure whether my guess on long_heshvan()
and short_kislev(), but for now it's working and we don't have any
further problem, so who cares ;-)

Thanks, I'm going to commit your fix.

Atsushi Eno

Yaacov Akiba Slama wrote:
> Hello Atsushi,
> 
> The enclosed patch seems to fix the bug.
> 
> You can use the link : http://www.abdicate.net/print.aspx?sdn=2453265 to 
> compare with the results of the program enclosed in 
> http://bugzilla.ximian.com/show_bug.cgi?id=76252
> Thanks,
> 
> --yas
> 
> Atsushi Eno wrote:
>> Hello,
>>
>> Lately I was looking at bug #76252 which is about HebrewCalendar.
>> I think I found the source of the bug, but also found that it is
>> pretty complex for me to understand the whole correct things...
>> so if anyone familiar with Hebrew Calendar could fix it, I'd be
>> so grateful.
>>
>> The source of the problem I think is in CCHebrewCalendar class in
>> mcs/class/System.Globalization/CalendralCalculations.cs.
>> CCHebrewCalendar.fixed_from_dmy() expects that for Hebrew month
>> under 7 it needs to add days of from 8th month to 12th or 13th month.
>> I think it could be either 7 or 8.
>>
>> However, if I rewrite this method as to do that, it causes infinite
>> loop since last_day_of_month() internally calls long_heshvan() and
>> short_kislev(). They both internally call days_in_year() which calls
>> fixed_from_dmy() - and thus it causes infinite loop.
>>
>> As long as I wikipedia it, the formula to compute days in Kislev
>> and Cheshvan (Heshvan) is pretty complex. It should not be like
>> current code which determines the number of days in chicken-and-egg
>> computation.
>> http://en.wikipedia.org/wiki/Hebrew_calendar
>>
>> Atsushi Eno
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>   
> 
> 
> ------------------------------------------------------------------------
> 
> --- mcs/class/corlib/System.Globalization/HebrewCalendar.cs
> +++ mcs/class/corlib/System.Globalization/HebrewCalendar.cs
> @@ -389,7 +389,7 @@
>  	/// <remarks>
>  	/// <para>
>  	/// In .NET the month counting starts with the Hebrew month Tishri.
> -	/// Calendrical Calculations starts with the month Tisan. So we must
> +	/// Calendrical Calculations starts with the month Nisan. So we must
>  	/// map here.
>  	/// </para>
>  	/// </remarks>
> @@ -456,9 +456,7 @@
>  	public override int GetDaysInMonth(int year, int month, int era) {
>  		M_CheckYME(year, month, ref era);
>  		int ccmonth = M_CCMonth(month, year); 
> -		int rd1 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth, year);
> -		int rd2 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth+1, year);
> -		return rd2 - rd1;
> +		return CCHebrewCalendar.last_day_of_month(ccmonth, year);
>  	}
>  
>  	/// <summary>




More information about the Mono-devel-list mailing list