Re: Week of month confusion?
Re: Week of month confusion?
- Subject: Re: Week of month confusion?
- From: Kyle Sluder <email@hidden>
- Date: Tue, 19 Mar 2013 07:59:07 -0700
On Mar 19, 2013, at 6:21 AM, Izak van Langevelde <email@hidden> wrote:
> I'm working on a small week-based calendar, but for some reason, the week number within the month of the first day of the month is either 0 or 1, while I would expect it to be 1.
Haven't confirmed it for all the values you've shown, but I believe it is returning 0 in instances where the week in which the date falls has fewer than the calendar's minimumDaysInFirstWeek in the specified month.
For example, February 1st, 2013 was a Friday. If your calendar's default minimumDaysInFirstWeek is greater than two (in locales where Sunday is the first day of the week), I would expect a value of 0 for the WeekOfMonth, which is the result you got. Meanwhile, January 1st, 2013 was a Tuesday, which leaves either five or days in that week of the month (if the week starts on Sunday), which is probably greater than the calendar's default minimumDaysInFirstWeek.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden