Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Can -ISO8601String ever be nil? #36

Open
kengruven opened this issue Sep 21, 2017 · 0 comments
Open

Can -ISO8601String ever be nil? #36

kengruven opened this issue Sep 21, 2017 · 0 comments

Comments

@kengruven
Copy link

This library is great! One question: can NSDate -ISO8601String ever be nil?

It's marked __nullable, but I'm not sure I understand why. It calls -ISO8601StringWithTimeZone (also __nullable), which in turn calls +stringForDateComponents, which is __nullable. That method returns nil if !hasDate && !hasTime, which makes sense.

I understand why the string formatter for NSDateComponents has to check this, and therefore be nullable. But if it's being called on a converted NSDate, that's always going to have them, right?

I guess what I'm suggesting is either:

  • NSDate -ISO8601String (and its WithTimeZone variant) shouldn't be __nullable, or:
  • it should document in what case these can return nil (because unlike the parsers, or the NSDateComponents variants, it's not at all obvious)

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant