> On Feb 16, 2016, at 9:52 PM, Greg Parker <gpar...@apple.com> wrote:
> 
> 
>> On Feb 16, 2016, at 6:34 PM, Eric Gorr <mail...@ericgorr.net> wrote:
>> 
>> When setting up a repeating event in Apple’s Calendar application, there is 
>> a lot of flexibility. For example, I can specify that an event repeats every 
>> month on the 5th Saturday. Of course, not every month has a fifth saturday, 
>> so for that month there is no event.
>> 
>> What I am wondering is if there is direct api support for doing these date 
>> calculations…can I supply a set of parameters to a function and ask what the 
>> next 5th saturday of the month is?
> 
> You can use NSDateComponents and NSCalendar to perform this sort of 
> calculation. For example, assuming a Gregorian calendar, you can use an 
> NSDateComponents object with weekday=7 and weekdayOrdinal=5 to represent 
> "fifth Saturday", and use NSCalendar 
> enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock: to 
> find "fifth Saturdays" after some starting date.

Is it possible to use NSDateComponents to specify the last Saturday of the 
month?

I was hoping that it might be possible to do with by using -1 for the 
weekdayOrdinal, but this does not appear to work.




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to