Пример #1
0
        //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);
            }
        }
Пример #2
0
 int IPhpComparable.Compare(PhpValue obj) => DateTimeFunctions.CompareTime(this.Time, obj);