Skip to content

Commit 15e091b

Browse files
committed
Update to support timestamps that end in Z instead of -0000
1 parent c295c8f commit 15e091b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

MModel.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ - (void)updateWithResourceJSON:(NSDictionary*)json
144144
*value = [NSNumber numberWithInt: [[json objectForKey: jsonKey] intValue]];
145145

146146
} else if ([type isEqualToString: @"T@\"NSDate\""]) {
147-
*value = [[json objectForKey: jsonKey] dateValueWithFormat: API_TIMESTAMP_FORMAT];
147+
NSString * timestamp = [json objectForKey: jsonKey];
148+
if ([timestamp hasSuffix: @"Z"])
149+
timestamp = [[timestamp substringToIndex:[timestamp length] - 1] stringByAppendingString:@"-0000"];
150+
151+
*value = [timestamp dateValueWithFormat: API_TIMESTAMP_FORMAT];
148152

149153
} else if ([type isEqualToString: @"T@\"MModelCollection\""]) {
150154
MModelCollection * collection = (MModelCollection *)*value;

0 commit comments

Comments
 (0)