File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -249,14 +249,22 @@ - (BOOL)assignValue:(id)value instance:(id)instance key:(NSString *)key property
249
249
250
250
[instance setValue: date forKey: key];
251
251
}
252
- else
252
+ else if ([value isKindOfClass: [ NSString class ]])
253
253
{
254
+ NSString *dateString = value;
255
+
254
256
if ([value length ] == 10 )
255
257
[formatter setDateFormat: @" yyyy-MM-dd" ];
256
- else
258
+ else if ([value length ] <= 19 )
257
259
[formatter setDateFormat: @" yyyy-MM-dd HH:mm:ss" ];
260
+ else
261
+ {
262
+ // Ruby on Rails compatibility for date formatted like: 2011-07-20T23:59:00-07:00
263
+ dateString = [value stringByReplacingOccurrencesOfString: @" :" withString: @" " ];
264
+ [formatter setDateFormat: @" yyyy-MM-dd'T'HHmmssZZ" ];
265
+ }
258
266
259
- [instance setValue: [formatter dateFromString: value ] forKey: key];
267
+ [instance setValue: [formatter dateFromString: dateString ] forKey: key];
260
268
}
261
269
262
270
}
You can’t perform that action at this time.
0 commit comments