mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
make dates in the tracker tab relative (say Today instead of September 27, 2009 for example)
This commit is contained in:
parent
87a48834cb
commit
298af84273
1 changed files with 16 additions and 24 deletions
|
@ -55,19 +55,15 @@
|
||||||
NSString * dateString;
|
NSString * dateString;
|
||||||
if (fStat.hasAnnounced && fStat.lastAnnounceTime != 0)
|
if (fStat.hasAnnounced && fStat.lastAnnounceTime != 0)
|
||||||
{
|
{
|
||||||
NSDate * announceDate = [NSDate dateWithTimeIntervalSince1970: fStat.lastAnnounceTime];
|
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
||||||
|
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
||||||
|
|
||||||
if ([NSApp isOnSnowLeopardOrBetter])
|
if ([NSApp isOnSnowLeopardOrBetter])
|
||||||
dateString = [NSDateFormatter localizedStringFromDate: announceDate dateStyle: NSDateFormatterFullStyle
|
[dateFormatter setDoesRelativeDateFormatting: YES];
|
||||||
timeStyle: NSDateFormatterShortStyle];
|
|
||||||
else
|
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastAnnounceTime]];
|
||||||
{
|
[dateFormatter release];
|
||||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
|
||||||
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
|
||||||
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
|
||||||
|
|
||||||
dateString = [dateFormatter stringFromDate: announceDate];
|
|
||||||
[dateFormatter release];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
||||||
|
@ -103,19 +99,15 @@
|
||||||
NSString * dateString;
|
NSString * dateString;
|
||||||
if (fStat.hasScraped && fStat.lastScrapeTime != 0)
|
if (fStat.hasScraped && fStat.lastScrapeTime != 0)
|
||||||
{
|
{
|
||||||
NSDate * scrapeDate = [NSDate dateWithTimeIntervalSince1970: fStat.lastScrapeTime];
|
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
||||||
|
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
||||||
|
|
||||||
if ([NSApp isOnSnowLeopardOrBetter])
|
if ([NSApp isOnSnowLeopardOrBetter])
|
||||||
dateString = [NSDateFormatter localizedStringFromDate: scrapeDate dateStyle: NSDateFormatterFullStyle
|
[dateFormatter setDoesRelativeDateFormatting: YES];
|
||||||
timeStyle: NSDateFormatterShortStyle];
|
|
||||||
else
|
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastScrapeTime]];
|
||||||
{
|
[dateFormatter release];
|
||||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
|
||||||
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
|
||||||
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
|
||||||
|
|
||||||
dateString = [dateFormatter stringFromDate: scrapeDate];
|
|
||||||
[dateFormatter release];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
||||||
|
|
Loading…
Reference in a new issue