using System; namespace Sony.Filtr.Utility { public static class NewMusicFridayManager { public static DateTime GetPrecedingFriday(DateTime utcDate) { do { utcDate = utcDate.AddDays(-1); } while (utcDate.DayOfWeek != DayOfWeek.Friday); return utcDate; } public static DateTime GetPrecedingOrCurrentFriday(DateTime utcDate) { while (utcDate.DayOfWeek != DayOfWeek.Friday) { utcDate = utcDate.AddDays(-1); } return utcDate.Date; } public static DateTime GetNextOrCurrentFriday(DateTime utcDate) { while (utcDate.DayOfWeek != DayOfWeek.Friday) { utcDate = utcDate.AddDays(1); } return utcDate.Date; } public static DateTime GetLogicalFridayForImport(DateTime utcDate) { if (utcDate.DayOfWeek == DayOfWeek.Thursday) return GetNextOrCurrentFriday(utcDate); return GetPrecedingOrCurrentFriday(utcDate); } } }