Skip to content

Commit 7b27c92

Browse files
committed
More commit list tweaks
1 parent 7557837 commit 7b27c92

File tree

2 files changed

+35
-142
lines changed

2 files changed

+35
-142
lines changed

Classes/GitXRelativeDateFormatter.m

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ - (NSString *)stringForObjectValue:(id)date
2727
NSInteger secondsAgo = lround([now timeIntervalSinceDate:date]);
2828

2929
if (secondsAgo < 0)
30-
return @"In the future!";
30+
return @"Future";
3131

3232
if (secondsAgo < MINUTE)
33-
return @"seconds ago";
33+
return @"s";
3434

3535
if (secondsAgo < (2 * MINUTE))
36-
return @"1 minute ago";
36+
return @"1 mn";
3737

3838
if (secondsAgo < HOUR)
39-
return [NSString stringWithFormat:@"%ld minutes ago", (secondsAgo / MINUTE)];
39+
return [NSString stringWithFormat:@"%ld mns", (secondsAgo / MINUTE)];
4040

4141
if (secondsAgo < (2 * HOUR))
42-
return @"1 hour ago";
42+
return @"1 hr";
4343

4444
// figure out # of days ago based on calender days (so yesterday is the day before today not 24 hours ago)
4545
NSDateFormatter *midnightFormmatter = [[NSDateFormatter alloc] init];
@@ -56,38 +56,28 @@ - (NSString *)stringForObjectValue:(id)date
5656
NSInteger monthsAgo = [components month];
5757
NSInteger daysAgo = [components day];
5858

59-
if (yearsAgo == 0) {
59+
if (yearsAgo < 2) {
6060
if (monthsAgo == 0) {
6161
// return "hours ago" if it's still today, but "Yesterday" only if more than 6 hours ago
6262
// gives people a little time to get used to the idea that yesterday is over :)
6363
if ((daysAgo == 0) || (secondsAgo < (6 * HOUR)))
64-
return [NSString stringWithFormat:@"%ld hours ago", (secondsAgo / HOUR)];
64+
return [NSString stringWithFormat:@"%ld hrs", (secondsAgo / HOUR)];
6565
if (daysAgo == 1)
66-
return @"Yesterday";
66+
return @"1 dy";
6767

6868
if (daysAgo >= (2 * WEEK))
69-
return [NSString stringWithFormat:@"%ld weeks ago", (daysAgo / WEEK)];
69+
return [NSString stringWithFormat:@"%ld wks", (daysAgo / WEEK)];
7070

71-
return [NSString stringWithFormat:@"%ld days ago", daysAgo];
71+
return [NSString stringWithFormat:@"%ld dys", daysAgo];
7272
}
7373

7474
if (monthsAgo == 1)
7575
return @"1 month ago";
7676

77-
return [NSString stringWithFormat:@"%ld months ago", monthsAgo];
77+
return [NSString stringWithFormat:@"%ld mths", monthsAgo];
7878
}
7979

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];
9181
}
9282

9383
@end

0 commit comments

Comments
 (0)