This file contains hidden or 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
@implementation NSDate (Extensions) | |
-(NSString *)timeAgo { | |
NSDate *now = [NSDate date]; | |
double deltaMinutes = fabs([self timeIntervalSinceDate:now]) / 60.0f; | |
if (deltaMinutes < 60){ | |
return @"a few minutes ago"; | |
} else if (deltaMinutes < 120) { | |
return @"an hour ago"; | |
} else if (deltaMinutes < (24 * 60)) { |
NewerOlder