I'm using the NSDate-TimeAgo library to format relative time in my iOS application. It displays the relative time of each post in its cell header, as so:
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *myDate = [df dateFromString: self.datePostedString];
UILabel *time = [[UILabel alloc]initWithFrame:CGRectMake(230,0,80,50)];
DDLogVerbose(@"Output is: \"%@\"", [myDate dateTimeAgo]);
time.text = [myDate dateTimeAgo];
time.textAlignment = NSTextAlignmentRight;
[time setFont:[UIFont systemFontOfSize:10]];
However, this library gives me strings that I find are too long. A post in the last minute would be labeled as "a minute ago". I'd like it to be shorter, such as "1m".
Is this possible to do without having to modify the library, or is there an alternative that already does this?