diff --git a/NzbDrone.Api/System/SystemModule.cs b/NzbDrone.Api/System/SystemModule.cs
index a013b15af..f409612fd 100644
--- a/NzbDrone.Api/System/SystemModule.cs
+++ b/NzbDrone.Api/System/SystemModule.cs
@@ -42,7 +42,8 @@ namespace NzbDrone.Api.System
IsLinux = OsInfo.IsLinux,
IsWindows = OsInfo.IsWindows,
Branch = _configFileProvider.Branch,
- Authentication = _configFileProvider.AuthenticationEnabled
+ Authentication = _configFileProvider.AuthenticationEnabled,
+ StartOfWeek = (int)OsInfo.FirstDayOfWeek
}.AsResponse();
}
diff --git a/NzbDrone.Common/DateTimeExtensions.cs b/NzbDrone.Common/DateTimeExtensions.cs
new file mode 100644
index 000000000..8b2ba6491
--- /dev/null
+++ b/NzbDrone.Common/DateTimeExtensions.cs
@@ -0,0 +1,24 @@
+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/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/NzbDrone.Common/EnvironmentInfo/OsInfo.cs
index b30c2c2ee..3b769bfea 100644
--- a/NzbDrone.Common/EnvironmentInfo/OsInfo.cs
+++ b/NzbDrone.Common/EnvironmentInfo/OsInfo.cs
@@ -28,5 +28,13 @@ namespace NzbDrone.Common.EnvironmentInfo
return !IsLinux;
}
}
+
+ public static DayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ return DateTime.Today.GetFirstDayOfWeek().DayOfWeek;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/NzbDrone.Common/NzbDrone.Common.csproj b/NzbDrone.Common/NzbDrone.Common.csproj
index 0d76e91a2..91c71c005 100644
--- a/NzbDrone.Common/NzbDrone.Common.csproj
+++ b/NzbDrone.Common/NzbDrone.Common.csproj
@@ -66,6 +66,7 @@
+
diff --git a/UI/Calendar/CalendarView.js b/UI/Calendar/CalendarView.js
index 38c3affea..ec4012a8e 100644
--- a/UI/Calendar/CalendarView.js
+++ b/UI/Calendar/CalendarView.js
@@ -21,6 +21,7 @@ define(
allDayDefault : false,
ignoreTimezone: false,
weekMode : 'variable',
+ firstDay : window.NzbDrone.ServerStatus.startOfWeek,
timeFormat : 'h(:mm)tt',
header : {
left : 'prev,next today',