Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSDictionary+JKSafeAccess have a bug #48

Closed
alpheus55 opened this issue Sep 17, 2018 · 1 comment
Closed

NSDictionary+JKSafeAccess have a bug #48

alpheus55 opened this issue Sep 17, 2018 · 1 comment

Comments

@alpheus55
Copy link

alpheus55 commented Sep 17, 2018

NSDictionary+JKSafeAccess have a bug

- (NSDate *)jk_dateForKey:(id)key dateFormat:(NSString *)dateFormat{
    NSDateFormatter *formater = [[NSDateFormatter alloc]init];
    formater.dateFormat = dateFormat;
    id value = [self objectForKey:key];
    
    if (value == nil || value == [NSNull null])
    {
        return nil;
    }
    
    if ([value isKindOfClass:[NSString class]] && ![value isEqualToString:@""] && !dateFormat) {
        return [formater dateFromString:value];
    }
    return nil; 
}

!dateFormat

@shaojiankui
Copy link
Owner

咋 没dateFormat 肯定转换不了啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants