From 45a5a50297f3eeec92e0755d8d85b6f0fb02dce0 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Wed, 10 May 2017 10:10:05 +0200 Subject: [PATCH] Fix for Arabic calendar --- Site/Bases/DataV5Base.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Site/Bases/DataV5Base.cs b/Site/Bases/DataV5Base.cs index 187c097a..6d453ed9 100644 --- a/Site/Bases/DataV5Base.cs +++ b/Site/Bases/DataV5Base.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using System.Threading; using System.Web; using System.Web.Security; using System.Web.UI; @@ -77,6 +78,17 @@ namespace Swarmops.Frontend GregorianCalendar normalizedCalendar = new GregorianCalendar(); normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; + + // 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 + } }