Is this possible?
Posted on 2014-03-26
I've built a calendar function that mimics the iPhone set up as far as being able to schedule recurring events. I've got "every day, every week, every two weeks, every month and every year."
To do this, I'll just start with the initial date and add whatever timeframe is needed. No biggie.
My client wants an option where they can schedule something on every third Wednesday of the month. Initially, I thought I would just add a "add 21 days" to the scheduling dynamic, but I knew intuitively this wouldn't work because not every month is 30 days. Consequently, I get the "third Wednesday" scenario happening on Wednesday then Friday etc.
My first reaction was to tell the client that the amount of coding to do what they're attempting would be significant just because you're having to anticipate every month and then the way the dates will shift from year to year.
But am I off? Is there a way to schedule "every third Wednesday?" If so, I'd love to get some feedback as to how to write that code. If I am thinking correctly, as far as telling them that they're asking for a volume of code that wouldn't be worth the cost, I'd love to hear some reinforcement there as well. Bottom line: If it's not on the iPhone, chances are there's a reason and in this instance, it's because you can't predict the mathematical value of "every third Wednesday" like you can something that's simply every 21 days.