Open boredzo opened 8 years ago
As a parser, NSISO8601DateFormatter is actually pretty different from boredzo/ISO8601DateFormatter. The NS one is basically just some ISO-8601-specific presets for their date parser. That is, I can take any valid ISO-8601 string and pass it to boredzo/ISO8601DateFormatter and get a Date object out of it. In order to pass an ISO-8601 string to NSISO8601DateFormatter, I have to first tell the parser exactly which variant of ISO-8601 to expect.
That's not workable for my program, so I'll be sticking with boredzo/ISO8601DateFormatter.
It may be feasible to replace the formatting half of ISO8601DateFormatter with the NS implementation.
On macOS 10.12 and iOS 10, Foundation has an NSISO8601DateFormatter class built in. It'd be cool if ISO8601DateFormatter wrapped that implementation when it's available, as an aid to clients who'd like to move toward that implementation.
Ingredients:
alloc
; have a class cluster; return the result of the NSISO8601DateFormatter implementation at the start of each ISO8601DateFormatter implementation—up to you.