I tried to get a NSDate from a NSString with UNKNOWN format, So I wrote a function like below
-(void)dateFromString:(NSString*)string {
    NSError *error = NULL;
    NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:(NSTextCheckingTypes)NSTextCheckingTypeDate error:&error];
    NSArray *matches = [detector matchesInString:string
                                         options:0
                                           range:NSMakeRange(0, [string length])];
    NSLocale* currentLoc = [NSLocale currentLocale];
    for (NSTextCheckingResult *match in matches) {
        if ([match resultType] == NSTextCheckingTypeDate) {
            NSLog(@"Date : %@", [[match date] descriptionWithLocale:currentLoc]);
        }
    }
}
It works well except for one place.
If I invoke
[self dateFromString:@"6/12"];
It prints
Date : Thursday, June 12, 2014 at 12:00:00 PM Australian Eastern Standard Time
At the same time if I call
[self dateFromString:@"13/12"];
it prints
Date : Friday, December 13, 2013 at 12:00:00 PM Australian Eastern Daylight Time
Basically, I want the function to behave consistent. Since I live in Australia, it should have returned December 6 for the first execution. Second call result is correct.
What am I doing wrong here?