mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 12:27:52 +08:00
Import http://boredzo.org/iso8601parser/ and add it as a defaultDateFormatter for parsing ISO8601 strings. Fixes #438
This commit is contained in:
@@ -535,7 +535,7 @@ relationship. Relationships are processed using an object mapping as well.
|
||||
@param dateFormatter An NSDateFormatter object to append to the end of the default formatters collection
|
||||
@see defaultDateFormatters
|
||||
*/
|
||||
+ (void)addDefaultDateFormatter:(NSDateFormatter *)dateFormatter;
|
||||
+ (void)addDefaultDateFormatter:(id)dateFormatter;
|
||||
|
||||
/**
|
||||
Convenience method for quickly constructing a date formatter and adding it to the collection of default
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#import "RKObjectRelationshipMapping.h"
|
||||
#import "RKObjectPropertyInspector.h"
|
||||
#import "RKLog.h"
|
||||
#import "RKISO8601DateFormatter.h"
|
||||
|
||||
// Constants
|
||||
NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE>";
|
||||
@@ -307,6 +308,10 @@ static NSDateFormatter *preferredDateFormatter = nil;
|
||||
// Setup the default formatters
|
||||
[self addDefaultDateFormatterForString:@"yyyy-MM-dd'T'HH:mm:ss'Z'" inTimeZone:nil];
|
||||
[self addDefaultDateFormatterForString:@"MM/dd/yyyy" inTimeZone:nil];
|
||||
|
||||
RKISO8601DateFormatter *isoFormatter = [[RKISO8601DateFormatter alloc] init];
|
||||
[self addDefaultDateFormatter:isoFormatter];
|
||||
[isoFormatter release];
|
||||
}
|
||||
|
||||
return defaultDateFormatters;
|
||||
@@ -321,7 +326,7 @@ static NSDateFormatter *preferredDateFormatter = nil;
|
||||
}
|
||||
|
||||
|
||||
+ (void)addDefaultDateFormatter:(NSDateFormatter *)dateFormatter {
|
||||
+ (void)addDefaultDateFormatter:(id)dateFormatter {
|
||||
[self defaultDateFormatters];
|
||||
[defaultDateFormatters addObject:dateFormatter];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user