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 ++++++- Podfile | 1 + Podfile.lock | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) 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]; diff --git a/Podfile b/Podfile index a4e5fa2..b353595 100644 --- a/Podfile +++ b/Podfile @@ -10,6 +10,7 @@ pod 'PDKeychainBindingsController' pod 'RestKit' pod 'SDWebImage' pod 'FontAwesome+iOS' +pod 'NSDate+TimeAgo' end target "JuickTests" do diff --git a/Podfile.lock b/Podfile.lock index cebc103..4af6877 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -13,6 +13,7 @@ PODS: - MWFeedParser/NSDate+InternetDateTime (0.0.1) - MWFeedParser/NSString+HTML (0.0.1) - MWFeedParser/NSString+XMLEntities (0.0.1) + - NSDate+TimeAgo (1.0.2) - PDKeychainBindingsController (0.0.1) - RestKit (0.21.0): - RestKit/Core @@ -45,6 +46,7 @@ DEPENDENCIES: - FontAwesome+iOS - Masonry - MWFeedParser + - NSDate+TimeAgo - PDKeychainBindingsController - RestKit - SDWebImage @@ -57,6 +59,7 @@ SPEC CHECKSUMS: ISO8601DateFormatterValueTransformer: d0af1f50a9df42db72d7418db31938b8473e0af8 Masonry: 73df2f346bd1a0044dc9de969aa45aea2f8a9bd8 MWFeedParser: 2ca0852fac352f8333d5f46fdd4b583b921e0c4e + NSDate+TimeAgo: fe93d3042e83093ae3630bc47ae7d57f782733f6 PDKeychainBindingsController: 463c207f8726e4aaec1ec20fd1876082ee86cb0a RestKit: c11a30e7bc73513d9d2c2695672aba7697d24181 RKValueTransformers: 1562d458b9c9d59ce777bfc5982f2e1aef2e9182 -- cgit v1.2.3