From ae905ed7107078b9681515d14b44b7283bd227e2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 18 Dec 2013 06:08:24 +0400 Subject: timeAgo --- Juick/MessageCell.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Juick/MessageCell.m') diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m index 0dea69a..04a08b3 100644 --- a/Juick/MessageCell.m +++ b/Juick/MessageCell.m @@ -9,6 +9,7 @@ #import "MessageCell.h" #import "ColorScheme.h" #import +#import "NSDate+TimeAgo.h" @interface MessageCell () @@ -145,7 +146,11 @@ [self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%d.png", [msg.userID intValue]]]]; __weak MessageCell *weakSelf = self; self.titleLabel.text = msg.user; - self.timestampLabel.text = msg.timestamp; + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; + [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]]; + + self.timestampLabel.text = [[formatter dateFromString:msg.timestamp] timeAgo]; if (msg.repliesCount > 0) { if ([msg.repliesBy length] > 0) { self.summaryLabel.text = [NSString stringWithFormat:@"%@ replies by %@", msg.repliesCount, msg.repliesBy]; -- cgit v1.2.3