@@ -165,6 +165,31 @@ - (void)testDecodingObjects {
165165 XCTAssertEqualObjects (object.objectId , @" 123" );
166166}
167167
168+ - (void )testDecodingObjectsWithDates {
169+ PFDecoder *decoder = [[PFDecoder alloc ] init ];
170+
171+ NSDictionary *decoded = [decoder decodeObject: @{ @" object" : @{@" __type" : @" Object" ,
172+ @" className" : @" Yolo" ,
173+ @" objectId" : @" 123" ,
174+ @" updatedAt" : @" 1970-01-01T00:00:01.000Z" ,
175+ @" createdAt" : @" 1970-01-01T00:00:02.000Z" } }];
176+ PFObject *object = decoded[@" object" ];
177+
178+ XCTAssertEqualObjects (object.updatedAt , [NSDate dateWithTimeIntervalSince1970: 1.0 ]);
179+ XCTAssertEqualObjects (object.createdAt , [NSDate dateWithTimeIntervalSince1970: 2.0 ]);
180+
181+ decoded = [decoder decodeObject: @{ @" object" : @{@" __type" : @" Object" ,
182+ @" className" : @" Yolo" ,
183+ @" objectId" : @" 123" ,
184+ @" updatedAt" : @{@" __type" : @" Date" ,
185+ @" iso" : @" 1970-01-01T00:00:01.000Z" },
186+ @" createdAt" : @{@" __type" : @" Date" ,
187+ @" iso" : @" 1970-01-01T00:00:02.000Z" }} }];
188+ object = decoded[@" object" ];
189+ XCTAssertEqualObjects (object.updatedAt , [NSDate dateWithTimeIntervalSince1970: 1.0 ]);
190+ XCTAssertEqualObjects (object.createdAt , [NSDate dateWithTimeIntervalSince1970: 2.0 ]);
191+ }
192+
168193- (void )testDecodingUnknownType {
169194 PFDecoder *decoder = [[PFDecoder alloc ] init ];
170195
0 commit comments