Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

parsedDate is nil on MagicalImportFunctions when changing iphone settings #700

Closed
aminebellakrid opened this Issue Mar 8, 2014 · 2 comments

Comments

Projects
None yet
2 participants

I have in my model a Date field "startTime" and in the userInfo :

{"dateFormat":"yyyy'-'MM'-'dd'T'HH':'mm':'ssZZZZZ"} 

So this is working and the parsed time is the right one.

But if you go to your iphone's

settings > general > date&time > enable 24-Hour Time. 

then relaunch my app crashes because parsedDate is nil in :

// In MagicalImportFunctions.m 

NSDate * dateFromString(NSString *value, NSString *format)
{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
    [formatter setLocale:[NSLocale currentLocale]];
    [formatter setDateFormat:format];

    NSDate *parsedDate = [formatter dateFromString:value];

    return parsedDate;
}

I am using 2.2 release .
I guess it's a date format issue but i don't know how to handle it. Any thought on this please @casademora @blackgold9 @tonyarnold ?
thanks

Contributor

tonyarnold commented Apr 2, 2014

See how you go with the workaround in #627, otherwise have a look at the tests included with MagicalRecord. Let me know if your workaround works OK.

@tonyarnold tonyarnold closed this Apr 2, 2014

👍 Alright thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment