Created
September 1, 2014 08:34
-
-
Save maripo/796c2b153807d411a3bc to your computer and use it in GitHub Desktop.
NSDate+Comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSDate (Comparison) | |
- (BOOL) isBefore: (NSDate*) date; | |
- (BOOL) isAfter: (NSDate*) date; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSDate+Comparison.h" | |
@implementation NSDate (Comparison) | |
- (BOOL) isBefore: (NSDate*) date { | |
return date != NULL && [self compare: date] == NSOrderedAscending; | |
} | |
- (BOOL) isAfter: (NSDate*) date { | |
return date != NULL && [self compare: date] == NSOrderedDescending; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment