Bug #29931 Connector/NET does not handle Saudi Hijri calendar correctly
Submitted: 20 Jul 2007 12:39 Modified: 7 Aug 2007 7:23
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.1.1.0 OS:Windows
Assigned to: CPU Architecture:Any

[20 Jul 2007 12:39] Sveta Smirnova
Description:
Connector/NET does not handle Saudi Hijri calendar correctly. 

Problem is class UmAlQuraCalendar. See also http://msdn2.microsoft.com/en-us/library/system.globalization.umalquracalendar(VS.80).aspx:

The UmAlQuraCalendar class is nearly identical to the HijriCalendar class, except the Saudi Hijri calendar uses a table-based algorithm licensed from the Saudi government to calculate dates, can express dates to the year 1450 A.H., and does not support the HijriAdjustment property.

How to repeat:
Run NET application on a user account with regional settings "Arabic (Saudi Arabia)"

You'll get error:

Specified time is not supported in this calendar. It should be between 07/18/0622 00:00:00 (Gregorian date) and 12/31/9999 23:59:59 (Gregorian date), inclusive.
Parameter name: time
Server stack trace:
at System.Globalization.HijriCalendar.CheckTicksRange(Int64 ticks)
at System.Globalization.HijriCalendar.GetDatePart(Int64 ticks, Int32 part)
at System.Globalization.HijriCalendar.GetDayOfMonth(DateTime time)
at System.DateTimeFormat.FormatCustomized(DateTime dateTime, String format, DateTimeFormatInfo dtfi)
at System.DateTimeFormat.Format(DateTime dateTime, String format, DateTimeFormatInfo dtfi)
at System.DateTime.ToString()
at MySql.Data.Types.MySqlDateTime.ComposePatterns()
at MySql.Data.Types.MySqlDateTime..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second, MySqlDbType type)
at MySql.Data.Types.MySqlDateTime.ParseMySql(String s, Boolean is41)
at MySql.Data.Types.MySqlDateTime.ReadValue(PacketReader reader, Int64 length)
at MySql.Data.MySqlClient.NativeDriver.ReadFieldValue(Int32 index, MySqlField field, MySqlValue valObject)
at MySql.Data.MySqlClient.CommandResult.ReadDataRow(Boolean loadFields)
at MySql.Data.MySqlClient.MySqlDataReader.Read()

Suggested fix:
Provide workaround of calendar limitation for users with "Arabic (Saudi Arabia)" regional settings
[20 Jul 2007 20:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/31289
[20 Jul 2007 20:16] Reggie Burnett
Fixed in 5.0.8 and 5.1.3
[20 Jul 2007 20:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/31290
[7 Aug 2007 7:23] MC Brown
A note has been added to the 5.0.8 and 5.1.3 changelogs: 

The Saudi Hijri calendar was not supported