iphone - NSCalendar dateFromComponents returns wrong value when using weeks -
so try weeks date range.
when current date components (only year , date) these values:

i noticed there "obsolescent" written near week. did try searching apple docs found nothing this.
then try nsdate current calendar (or gregorian calendar, same value) value is:

so weeks got ignored. added few months , 1 week components , had such components:

then tried date out of this, got:

now week components getting ignored here. why so? deprecated? or bug?
so found solution finally.
it appears sorts out (starts working) if set weekday:
[startdate setweekday:1]; then date week returned correctly.
do not know if still bug when week components ignored without setting weekday.
Comments
Post a Comment