I have a quick question. According to apple official documentation https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/#//apple_ref/occ/instm/NSDateFormatter/dateFromString:
NSDateFormatter.dateFromString(String) would return
A date representation of string interpreted using the receiver’s current settings. If dateFromString: can not parse the string, returns nil.
Then I when I give it an empty string "", should it return nil? When I do this in the playground
let date = ""
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyyMMdd"
print(dateFormatter.dateFromString(date))
It gave me
"Optional(1999-12-31 15:00:00 +0000)\n"
Is this happen to be a normal behaviour? Or am I doing something wrong?
Thank you
yyyy-MM-dd, you would have gottennil.