/// <summary> /// Generates dates in the given format for the Day DateType with the start and end dates. /// </summary> /// <param name="inputFormat">The inputDate format</param> /// <param name="displayFormat">The display date format</param> /// <param name="start">The start date from which to start searching</param> /// <param name="end">The end date at which to stop searching</param> /// <returns>An array of date strings after applying the rule from the start date to end date. /// The format of strings in this array is the display date format. /// </returns> /// /// <remarks> /// Due to a design bug, the date must be specified in such a way that the format [DateValue][space][TimeValue] /// is in the correct input date format. Conversely, any input date formats not in [DateValue][space][TimeValue] /// format are not supported. /// </remarks> /// <exception cref="RuleInvalidDataException">If the dates could not be generated due to either incorrect /// inputFormat/displayFormat or invalid DateValue/TimeValue</exception> private string[] GenerateDatesForDayDateType(string inputFormat, string displayFormat, DateTime start, DateTime end) { string dateAndTime = String.Empty; DateTime parsedDate; List <DateTime> ret = new List <DateTime>(); try { //Time values may be semi colon delimited string[] timeValues = TimeValue.Split(';'); foreach (string timeValue in timeValues) { //Form a [DateValue][space][TimeValue] string dateAndTime = DateValue.TrimEnd() + " " + timeValue.TrimStart(); dateAndTime = dateAndTime.Trim(); //Try to parse it using inputFormat parsedDate = DateTime.ParseExact(dateAndTime, inputFormat, CultureInfo.InvariantCulture); if (parsedDate.Year % YearDivisor == 0 && parsedDate >= start && parsedDate <= end) { ret.Add(parsedDate); } } } catch (Exception e) { throw new RuleInvalidDataException(dateAndTime + " is not a valid date for the format : " + inputFormat, e); } return(FormatListAndReturnArray(ret, displayFormat)); }