Tom Coomer Tom Coomer - 4 months ago 25x
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?



I find the earlierDate methode.

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

You have also the laterDate