Add support for mapping of numeric dates encoded in strings via NSNumberFormatter. closes #815

This commit is contained in:
Blake Watters
2012-09-25 21:18:03 -04:00
parent 618b1e094c
commit e56754cb65
3 changed files with 6 additions and 1 deletions

View File

@@ -613,7 +613,7 @@ static BOOL is_leap_year(NSUInteger year);
*outTimeZone = timeZone;
}
return components;
return isValidDate ? components : nil;
}
- (NSDate *) dateFromString:(NSString *)string {
@@ -625,6 +625,7 @@ static BOOL is_leap_year(NSUInteger year);
- (NSDate *)dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange {
NSTimeZone *timeZone = nil;
NSDateComponents *components = [self dateComponentsFromString:string timeZone:&timeZone range:outRange];
if (! components) return nil;
if (outTimeZone)
*outTimeZone = timeZone;
parsingCalendar.timeZone = timeZone;