Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get rid of NSUserDefaults deprecated constants for date and time info…
…rmation.
  • Loading branch information
barijaona committed Jun 18, 2013
1 parent 8a7d4a9 commit 373a5fc
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/CalendarExtensions.m
Expand Up @@ -73,8 +73,7 @@ -(NSString *)friendlyDescription
}
else
{
NSString * outputFormat = [defaults objectForKey:@"NSShortDateFormatString"];
theDate = [self descriptionWithCalendarFormat:outputFormat];
theDate = [NSDateFormatter localizedStringFromDate:self dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterNoStyle];
}

// If the time is 12.00 then replace with Noon or Midnight as appropriate.
Expand All @@ -91,10 +90,7 @@ -(NSString *)friendlyDescription
}
else
{
// Use the user's preferred time format but strip off the seconds.
NSMutableString * outputFormat = [NSMutableString stringWithString:[defaults objectForKey:@"NSTimeFormatString"]];
[outputFormat replaceOccurrencesOfString:@":%S" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, [outputFormat length])];
theTime = [self descriptionWithCalendarFormat:outputFormat];
theTime = [NSDateFormatter localizedStringFromDate:self dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
}
return [NSString stringWithFormat:NSLocalizedString(@"%@ at %@", nil), theDate, theTime];
}
Expand Down

0 comments on commit 373a5fc

Please sign in to comment.