I'm try to get birth data for contacts but if user does not choose year or the contact come from Facebook and the year or the data it self is hidden so it give me the "1604" value for the year u can see what i mean in the image.
Congratulations, you've discovered an implementation detail!
First off, Contacts stores dates as points in time, and it is impossible to store a point in time without a year, because every point in time has a year. Thus, a decision had to be made about how Address Book would store an "unknown" year in a date. It was decided that "1604" would be a fine year, for several reasons:
Thus, if you're pulling birthdates out of Address Book, you'll need to special-case 1604 as the "birthdate where the year is unknown".
Note: To my knowledge, this is only supported when dealing with the Gregorian calendar. For all other calendars, this behavior is undefined.
You can init the year in viewDidLoad.
Or check if the year was not chosen by the user, present error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With