[firestore][ios] Retain timezone information when formatting the date

This commit is contained in:
Chris Bianca 2017-10-13 11:40:31 +01:00
parent 93d152df42
commit 0af5e71b4f
1 changed files with 2 additions and 2 deletions

View File

@ -217,7 +217,7 @@ static NSMutableDictionary *_listeners;
} else if ([value isKindOfClass:[NSDate class]]) {
typeMap[@"type"] = @"date";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
typeMap[@"value"] = [dateFormatter stringFromDate:(NSDate *)value];
} else if ([value isKindOfClass:[NSNumber class]]) {
NSNumber *number = (NSNumber *)value;
@ -274,7 +274,7 @@ static NSMutableDictionary *_listeners;
return [[FIRGeoPoint alloc] initWithLatitude:[latitude doubleValue] longitude:[longitude doubleValue]];
} else if ([type isEqualToString:@"date"]) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
return [dateFormatter dateFromString:value];
} else if ([type isEqualToString:@"fieldvalue"]) {
NSString *string = (NSString*)value;