mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +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
|
@ -54,21 +54,17 @@
|
||||||
{
|
{
|
||||||
NSString * dateString;
|
NSString * dateString;
|
||||||
if (fStat.hasAnnounced && fStat.lastAnnounceTime != 0)
|
if (fStat.hasAnnounced && fStat.lastAnnounceTime != 0)
|
||||||
{
|
|
||||||
NSDate * announceDate = [NSDate dateWithTimeIntervalSince1970: fStat.lastAnnounceTime];
|
|
||||||
if ([NSApp isOnSnowLeopardOrBetter])
|
|
||||||
dateString = [NSDateFormatter localizedStringFromDate: announceDate dateStyle: NSDateFormatterFullStyle
|
|
||||||
timeStyle: NSDateFormatterShortStyle];
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
||||||
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
||||||
|
|
||||||
dateString = [dateFormatter stringFromDate: announceDate];
|
if ([NSApp isOnSnowLeopardOrBetter])
|
||||||
|
[dateFormatter setDoesRelativeDateFormatting: YES];
|
||||||
|
|
||||||
|
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastAnnounceTime]];
|
||||||
[dateFormatter release];
|
[dateFormatter release];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
||||||
|
|
||||||
|
@ -102,21 +98,17 @@
|
||||||
{
|
{
|
||||||
NSString * dateString;
|
NSString * dateString;
|
||||||
if (fStat.hasScraped && fStat.lastScrapeTime != 0)
|
if (fStat.hasScraped && fStat.lastScrapeTime != 0)
|
||||||
{
|
|
||||||
NSDate * scrapeDate = [NSDate dateWithTimeIntervalSince1970: fStat.lastScrapeTime];
|
|
||||||
if ([NSApp isOnSnowLeopardOrBetter])
|
|
||||||
dateString = [NSDateFormatter localizedStringFromDate: scrapeDate dateStyle: NSDateFormatterFullStyle
|
|
||||||
timeStyle: NSDateFormatterShortStyle];
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
|
||||||
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
|
||||||
|
|
||||||
dateString = [dateFormatter stringFromDate: scrapeDate];
|
if ([NSApp isOnSnowLeopardOrBetter])
|
||||||
|
[dateFormatter setDoesRelativeDateFormatting: YES];
|
||||||
|
|
||||||
|
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastScrapeTime]];
|
||||||
[dateFormatter release];
|
[dateFormatter release];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue