// LastCompletedSyncTransformer.m
// pithos-macos
//
-// Copyright 2011 GRNET S.A. All rights reserved.
+// Copyright 2011-2012 GRNET S.A. All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following
- (id)transformedValue:(id)value {
if (value == nil)
- return @"Last Sync: -";
+ return @"-";
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *comps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:[NSDate date]];
NSTimeInterval timeInterval = [[calendar dateFromComponents:comps] timeIntervalSinceDate:(NSDate *)value];
if (timeInterval < 86400) {
// Today
- return [NSString stringWithFormat:@"Last Sync: Today %@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
+ return [NSString stringWithFormat:@"Today %@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
dateStyle:NSDateFormatterNoStyle
timeStyle:NSDateFormatterShortStyle]];
} else if (timeInterval < 172800) {
// Yesterday
- return [NSString stringWithFormat:@"Last Sync: Yesterday %@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
+ return [NSString stringWithFormat:@"Yesterday %@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
dateStyle:NSDateFormatterNoStyle
timeStyle:NSDateFormatterShortStyle]];
} else {
- return [NSString stringWithFormat:@"Last Sync: %@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
+ return [NSString stringWithFormat:@"%@", [NSDateFormatter localizedStringFromDate:(NSDate *)value
dateStyle:NSDateFormatterShortStyle
timeStyle:NSDateFormatterShortStyle]];
}