DDay.iCal.Event.OccursOn C# (CSharp) Method

OccursOn() public method

Use this method to determine if an event occurs on a given date. This event should be called only after the Evaluate method has calculated the dates for which this event occurs.
public OccursOn ( IDateTime DateTime ) : bool
DateTime IDateTime The date to test.
return bool
        virtual public bool OccursOn(IDateTime DateTime)
        {
            foreach (IPeriod p in m_Evaluator.Periods)
                // NOTE: removed UTC from date checks, since a date is a date.
                if (p.StartTime.Date == DateTime.Date ||    // It's the start date OR
                    (p.StartTime.Date <= DateTime.Date &&   // It's after the start date AND
                    (p.EndTime.HasTime && p.EndTime.Date >= DateTime.Date || // an end time was specified, and it's after the test date
                    (!p.EndTime.HasTime && p.EndTime.Date > DateTime.Date)))) // an end time was not specified, and it's before the end date
                    // NOTE: fixed bug as follows:
                    // DTSTART;VALUE=DATE:20060704
                    // DTEND;VALUE=DATE:20060705
                    // Event.OccursOn(new iCalDateTime(2006, 7, 5)); // Evals to true; should be false
                    return true;
            return false;
        }