forked from jerrykrinock/CategoriesObjC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSDate+SafeCompare.h
37 lines (28 loc) · 896 Bytes
/
NSDate+SafeCompare.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#import <Cocoa/Cocoa.h>
/*!
@ @brief defined to be NSOrderedAscending
@details So I don't have to look at documentation every
time I use -[NSDate compare:]
*/
#define NSDateIsEarlierThan NSOrderedAscending
/*!
@ @brief defined to be NSOrderedDescending
@details So I don't have to look at documentation every
time I use -[NSDate compare:]
*/
#define NSDateIsLaterThan NSOrderedDescending
/*
NSDate's instance methods such as -laterDate: may not give the
sensible result when one of the dates is nil. These class methods
give sensible results in all cases.
*/
@interface NSDate (SafeCompare)
/*!
@brief Returns the later of two dates, even if either is nil.
@details If either date is nil, returns the other date. If
both dates are nil, returns nil.
@result date1, date2, or nil.
*/
+ (NSDate*)laterDate:(NSDate*)date1
date:(NSDate*)date2 ;
@end