//public void __construct(string isostr, int options = 0) //{ // // https://en.wikipedia.org/wiki/ISO_8601#Repeating_intervals // // "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M" // throw new NotImplementedException(); //} IEnumerator <DateTimeInterface> IEnumerable <DateTimeInterface> .GetEnumerator() { DateTimeImmutable current = start as DateTimeImmutable ?? (start as DateTime)?.AsDateTimeImmutable() ?? throw new InvalidOperationException(); if (include_start_date) { yield return(current); } if (end == null && recurrences == 0) { yield break; } if (interval.IsZero) { yield break; } for (int index = 0; ; index++) { current = current.add(interval); if (end != null && DateTimeFunctions.GetDateTimeFromInterface(end, out var end_datetime, out _)) { if (current.Time > end_datetime) { yield break; } }
//public void __construct(string isostr, int options = 0) //{ // // https://en.wikipedia.org/wiki/ISO_8601#Repeating_intervals // // "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M" // throw new NotImplementedException(); //} IEnumerator <DateTimeInterface> IEnumerable <DateTimeInterface> .GetEnumerator() { var current = DateTimeImmutable.createFromInterface(start); if (include_start_date) { yield return(current); } if (end == null && recurrences == 0) { yield break; } if (interval.IsZero) { yield break; } for (int index = 0; ; index++) { current = current.add(interval); if (end != null && DateTimeFunctions.CompareTime(current, end) > 0) { yield break; } if (index >= recurrences) { yield break; } // yield return(current); } }