From 9645fb07db4a574e6eae6c1b5a0dc316dd5d64b5 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 28 Mar 2014 16:45:29 -0700 Subject: [PATCH] Removed DateTimeExtensions --- src/NzbDrone.Common/DateTimeExtensions.cs | 24 ------------------- src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs | 3 ++- src/NzbDrone.Common/NzbDrone.Common.csproj | 1 - 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 src/NzbDrone.Common/DateTimeExtensions.cs diff --git a/src/NzbDrone.Common/DateTimeExtensions.cs b/src/NzbDrone.Common/DateTimeExtensions.cs deleted file mode 100644 index 8b2ba6491..000000000 --- a/src/NzbDrone.Common/DateTimeExtensions.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Globalization; - -namespace NzbDrone.Common -{ - public static class DateTimeExtensions - { - public static DateTime GetFirstDayOfWeek(this DateTime dayInWeek) - { - var defaultCultureInfo = CultureInfo.CurrentCulture; - return GetFirstDayOfWeek(dayInWeek, defaultCultureInfo); - } - - public static DateTime GetFirstDayOfWeek(this DateTime dayInWeek, CultureInfo cultureInfo) - { - DayOfWeek firstDay = cultureInfo.DateTimeFormat.FirstDayOfWeek; - DateTime firstDayInWeek = dayInWeek.Date; - while (firstDayInWeek.DayOfWeek != firstDay) - firstDayInWeek = firstDayInWeek.AddDays(-1); - - return firstDayInWeek; - } - } -} diff --git a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs index 16894f00c..bdd7c14ac 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using System.Runtime.InteropServices; namespace NzbDrone.Common.EnvironmentInfo @@ -18,7 +19,7 @@ static OsInfo() IsLinux = IsMono && !IsOsx; IsWindows = !IsMono; - FirstDayOfWeek = DateTime.Today.GetFirstDayOfWeek().DayOfWeek; + FirstDayOfWeek = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; if (!IsMono) { diff --git a/src/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj index b6666bda7..086bd8d80 100644 --- a/src/NzbDrone.Common/NzbDrone.Common.csproj +++ b/src/NzbDrone.Common/NzbDrone.Common.csproj @@ -66,7 +66,6 @@ -