Created
November 9, 2011 13:38
-
-
Save notjosh/1351451 to your computer and use it in GitHub Desktop.
NSDate+Comparison - adios NSOrdered*
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
// | |
// NSDate+Comparison.h | |
// | |
// Created by Joshua May on 4/11/11. | |
// Copyright (c) 2011 Joshua May. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSDate (Comparison) | |
- (BOOL)isBeforeDate:(NSDate *)date; | |
- (BOOL)isAfterDate:(NSDate *)date; | |
- (BOOL)isSameAsDate:(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
// | |
// NSDate+Comparison.m | |
// | |
// Created by Joshua May on 4/11/11. | |
// Copyright (c) 2011 Joshua May. All rights reserved. | |
// | |
#import "NSDate+Comparison.h" | |
@implementation NSDate (Comparison) | |
- (BOOL)isBeforeDate:(NSDate *)date { | |
return (NSOrderedAscending == [self compare:date]); | |
} | |
- (BOOL)isAfterDate:(NSDate *)date { | |
return (NSOrderedDescending == [self compare:date]); | |
} | |
- (BOOL)isSameAsDate:(NSDate *)date { | |
return (NSOrderedSame == [self compare:date]); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're missing two methods. :-)