@@ -27,19 +27,19 @@ - (NSString *)stringForObjectValue:(id)date
27
27
NSInteger secondsAgo = lround ([now timeIntervalSinceDate: date]);
28
28
29
29
if (secondsAgo < 0 )
30
- return @" In the future! " ;
30
+ return @" Future " ;
31
31
32
32
if (secondsAgo < MINUTE)
33
- return @" seconds ago " ;
33
+ return @" s " ;
34
34
35
35
if (secondsAgo < (2 * MINUTE))
36
- return @" 1 minute ago " ;
36
+ return @" 1 mn " ;
37
37
38
38
if (secondsAgo < HOUR)
39
- return [NSString stringWithFormat: @" %ld minutes ago " , (secondsAgo / MINUTE)];
39
+ return [NSString stringWithFormat: @" %ld mns " , (secondsAgo / MINUTE)];
40
40
41
41
if (secondsAgo < (2 * HOUR))
42
- return @" 1 hour ago " ;
42
+ return @" 1 hr " ;
43
43
44
44
// figure out # of days ago based on calender days (so yesterday is the day before today not 24 hours ago)
45
45
NSDateFormatter *midnightFormmatter = [[NSDateFormatter alloc ] init ];
@@ -56,38 +56,28 @@ - (NSString *)stringForObjectValue:(id)date
56
56
NSInteger monthsAgo = [components month ];
57
57
NSInteger daysAgo = [components day ];
58
58
59
- if (yearsAgo == 0 ) {
59
+ if (yearsAgo < 2 ) {
60
60
if (monthsAgo == 0 ) {
61
61
// return "hours ago" if it's still today, but "Yesterday" only if more than 6 hours ago
62
62
// gives people a little time to get used to the idea that yesterday is over :)
63
63
if ((daysAgo == 0 ) || (secondsAgo < (6 * HOUR)))
64
- return [NSString stringWithFormat: @" %ld hours ago " , (secondsAgo / HOUR)];
64
+ return [NSString stringWithFormat: @" %ld hrs " , (secondsAgo / HOUR)];
65
65
if (daysAgo == 1 )
66
- return @" Yesterday " ;
66
+ return @" 1 dy " ;
67
67
68
68
if (daysAgo >= (2 * WEEK))
69
- return [NSString stringWithFormat: @" %ld weeks ago " , (daysAgo / WEEK)];
69
+ return [NSString stringWithFormat: @" %ld wks " , (daysAgo / WEEK)];
70
70
71
- return [NSString stringWithFormat: @" %ld days ago " , daysAgo];
71
+ return [NSString stringWithFormat: @" %ld dys " , daysAgo];
72
72
}
73
73
74
74
if (monthsAgo == 1 )
75
75
return @" 1 month ago" ;
76
76
77
- return [NSString stringWithFormat: @" %ld months ago " , monthsAgo];
77
+ return [NSString stringWithFormat: @" %ld mths " , monthsAgo];
78
78
}
79
79
80
- if (yearsAgo == 1 ) {
81
- if (monthsAgo == 0 )
82
- return @" 1 year ago" ;
83
-
84
- if (monthsAgo == 1 )
85
- return @" 1 year 1 month ago" ;
86
-
87
- return [NSString stringWithFormat: @" 1 year %ld months ago" , monthsAgo];
88
- }
89
-
90
- return [NSString stringWithFormat: @" %ld years ago" , yearsAgo];
80
+ return [NSString stringWithFormat: @" %ld yrs" , yearsAgo];
91
81
}
92
82
93
83
@end
0 commit comments