From 2ccc44954affc751bf58a239aa24fe7e7ac678af Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Mon, 5 Sep 2011 17:54:07 -0400 Subject: [PATCH] Configured default locale to en_US_POSIX for default date formatters. closes #273 --- Code/ObjectMapping/RKObjectMapping.h | 2 +- Code/ObjectMapping/RKObjectMapping.m | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Code/ObjectMapping/RKObjectMapping.h b/Code/ObjectMapping/RKObjectMapping.h index c16b1509..babfab04 100644 --- a/Code/ObjectMapping/RKObjectMapping.h +++ b/Code/ObjectMapping/RKObjectMapping.h @@ -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. diff --git a/Code/ObjectMapping/RKObjectMapping.m b/Code/ObjectMapping/RKObjectMapping.m index eba06638..825c48f2 100644 --- a/Code/ObjectMapping/RKObjectMapping.m +++ b/Code/ObjectMapping/RKObjectMapping.m @@ -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;