Skip to content

Instantly share code, notes, and snippets.

@maripo
Created September 1, 2014 08:34
Show Gist options
  • Save maripo/796c2b153807d411a3bc to your computer and use it in GitHub Desktop.
Save maripo/796c2b153807d411a3bc to your computer and use it in GitHub Desktop.
NSDate+Comparison
#import <Foundation/Foundation.h>
@interface NSDate (Comparison)
- (BOOL) isBefore: (NSDate*) date;
- (BOOL) isAfter: (NSDate*) date;
@end
#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