Tom Coomer Tom Coomer - 5 months ago 41
Swift Question

Check if date is before current date (Swift)

I would like to check if a NSDate is before (in the past) by comparing it to the current date. How would I do this?

Thanks

Answer

I find the earlierDate methode.

if Date1.earlierDate(Date2).isEqualToDate(Date1)  {
            print(Date1 is earlier than Date2)
        }

You have also the laterDate

Comments