boredzo / iso-8601-date-formatter

A Cocoa NSFormatter subclass to convert dates to and from ISO-8601-formatted strings. Supports calendar, week, and ordinal formats.
http://boredzo.org/iso8601dateformatter/
Other
600 stars 140 forks source link

Use NSISO8601DateFormatter when available #74

Open boredzo opened 8 years ago

boredzo commented 8 years ago

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:

kengruven commented 4 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.