Monday, January 12, 2015

Lenient Date Parsing

Mike Abdullah:

As far as I can see, [NSDateFormatter.lenient] doesn’t support anything like the range of the older APIs. Indeed as best I can tell the leniency only comes into play as far as separator characters are concerned. So for example, if dates are expected to be in the format YYYY/MM/DD, then strings of the form YYYY-MM-DD will also be accepted. But that’s about it.

NSDataDetector is a possible solution.

Comments RSS · Twitter

Leave a Comment