private static IList <TimeSpan> GetTimes(string input) { var times = input .Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries) .Select(s => s.Trim()) .Select(s => DateStringParser.ParseTime(s).TimeOfDay) .ToList(); return(times); }
public static CronTemplate ForDays(DaysOfWeek daysOfWeek, string time) { var daysOfWeekList = GetDaysListFromEnum(daysOfWeek); var timeValue = DateStringParser.ParseTime(time); var cronTemplate = new CronTemplateBuilder() .WithMinutes(timeValue.Minute) .WithHours(timeValue.Hour) .WithAllDaysOfMonth() .WithDaysOfWeek(daysOfWeekList.ToArray()) .WithAllMonths() .Build(); return(cronTemplate); }
private void Test(string s, DateTime dateTime) { var time = DateStringParser.ParseTime(s); time.TimeOfDay.Should().Be(dateTime.TimeOfDay); }