diff --git a/Site5/App_Code/CommonV5.cs b/Site5/App_Code/CommonV5.cs index 8c759e62..d9f5b321 100644 --- a/Site5/App_Code/CommonV5.cs +++ b/Site5/App_Code/CommonV5.cs @@ -49,13 +49,12 @@ public class CommonV5 }*/ } + GregorianCalendar normalizedCalendar = new GregorianCalendar(); + normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; // avoids problems with Arabic, etc, calendars and bookkeeping in localization + try { - GregorianCalendar normalizedCalendar = new GregorianCalendar(); - normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; // avoids problems with Arabic, etc, calendars and bookkeeping in localization - Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(preferredCulture); - Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = normalizedCalendar; } catch (Exception) // if we can't set the culture, what do we do? ("We send the Marines.") { @@ -64,6 +63,17 @@ public class CommonV5 // Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; } + // Set the calendar to GregorianCalendar.USEnglish. This sometimes fails on Windows but works on Mono. If it fails on Windows, no biggie b/c + // this is supposed to be the default anyway. + try + { + Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = normalizedCalendar; + } + catch (Exception) + { + // meh + } + Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; }