Configured default locale to en_US_POSIX for default date formatters. closes #273

This commit is contained in:
Blake Watters
2011-09-05 17:54:07 -04:00
parent 54007c78d4
commit 2ccc44954a
2 changed files with 3 additions and 1 deletions

View File

@@ -482,7 +482,7 @@ relationship. Relationships are processed using an object mapping as well.
/**
Convenience method for quickly constructing a date formatter and adding it to the collection of default
date formatters
date formatters. The locale is auto-configured to en_US_POSIX
@param dateFormatString The dateFormat string to assign to the newly constructed NSDateFormatter instance
@param nilOrTimeZone The NSTimeZone object to configure on the NSDateFormatter instance. Defaults to UTC time.

View File

@@ -322,6 +322,7 @@ static NSDateFormatter *preferredDateFormatter = nil;
+ (void)addDefaultDateFormatterForString:(NSString *)dateFormatString inTimeZone:(NSTimeZone *)nilOrTimeZone {
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateFormat = dateFormatString;
dateFormatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
if (nilOrTimeZone) {
dateFormatter.timeZone = nilOrTimeZone;
} else {
@@ -337,6 +338,7 @@ static NSDateFormatter *preferredDateFormatter = nil;
preferredDateFormatter = [NSDateFormatter new];
[preferredDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
preferredDateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
preferredDateFormatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
}
return preferredDateFormatter;