How to setup single Pay Day Event

Hello,


I thought this was a simple thing but I'm not so sure now. I'd like to setup an all-day event for my payday, which is twice a month: the last weekday before the 15th and the last weekday before the 30th. There doesn't seem to be a way to do this within the iCal interface.


I found a couple of other post, namely this one:

https://discussions.apple.com/thread/3326673?answerId=16159549022#16159549022


which got me going in the right direction. I was able to get an event setup for the 15th using this:


RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYMONTHDAY=13,14,15;BYDAY=MO,TU,WE,TH,FR

So thats the last weekday before the 15. I had to add the 13,14,15 since those are esentially the only possible dates that I can occur. (Worst case would be that the 15th is Sunday, so the preceding Friday would be the 13th



Here's the rrule for the second event that covers my 2nd payday:

RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR



My quesiton is, is there an easy way to merge these into a single event? I'm more curious that anything.


Thank you!

MacBook Pro, OS X Mountain Lion (10.8.1)

Posted on Sep 17, 2012 9:04 AM

Reply
5 replies

Sep 17, 2012 1:11 PM in response to John Maisey

Hi John,


Apologies if I wasn't clear. I'm looking for an event that would recur on the 15th and 30th of every month, or the last weekday before those dates if either happen to fall on a Saturday or Sunday.


I tried your rewrite and it appears to work for the instance on the 15th, but no event showed up for me around the 30th. Not sure if I did anything wrong but I just pasted your RRULE over the one that I'd setup previously, saved, then opened it with Calendar.


I'm still learning the syntax so perhaps you could brifely help me understand how your BYSETPOS value of 5 actually gets me to the proper date?


Thanks very much,

RL

Sep 17, 2012 1:05 PM in response to RodLaver

H RodLaver,


is there an easy way to merge these into a single event?


I suppose it depends on how you define easy. 😉


I'm also not sure I know what you are after as you say the last day before the 15th and 30th. but your examples represent the last weekday before the 16th and the last weekday of the month (even if it is the 31st).


After a couple of attempts I came up with this which may be what you're asking for depending on the above:


RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=5,-1;BYMONTHDAY=9,10,11,12,13,14,15,26,27,28,29,30;BYDAY=MO,TU,WE,TH,FR


This sets the event to be on the 5th and last of the dates in the BYMONTHDAY list that fall on a weekday for the month. In practice this will be the 13/14/15th and also the last weekday before the 31st (this could be 26th-30th to take into account months with 28 days).


Best wishes

John M

Sep 17, 2012 1:32 PM in response to RodLaver

I'm sorry if it didn't work for the 30th for you. It works here fine. Can you post backthe RRULE line you have in your file?


The BYMONTHDAY filters the days of the month. BYDAY makes a filter that only sets an event on dates in the BYMONTHDAY list that fall in dates in the BYDAY list. The BYSETPOS filters this further to only the items in the list set.


For example using December 2012:

In December 2012 the weekends fall on the 1st/2nd, 8th/9th, 15th/16th, 22/23rd, 29th/30th of the month.

BYMONTHDAY filters to the dates: 9,10,11,12,13,14,15,26,27,28,29,30.

BYDAY with MO,TU,WE,TH,FR filters these further to: 10,11,12,13,14,26,27,28, removing dates falling on Sat-Sun.

BYSETPOS set to 5,-1 then filters to the 5th and last in the list after the BYDAY filter, giving the 14th and 28th.


I hope this makes sense.


Best wishes

John M

Sep 17, 2012 1:51 PM in response to John Maisey

Thanks very much, John


I just dscovered that my paste didn't grab the entire line. Your rule seems to do the trick.


Thanks for the very informative explanation as well. I had one additional questions along these lines. Why are the dates 9-12 and 26-28 needed in the list of BYMONTHDAY and how is the weekday 15th date guaranteed to be the 5th in the resulting list? I'm having trouble wrapping my head around that.


Cheers,
RL

Sep 17, 2012 2:28 PM in response to RodLaver

It may make it clearer if I split the rule into two.


Let's start with the 30th because I think it is easier to grasp...


This is the relevant part of a RRULE that just gives the last day before the 30th, inclusive.


...BYSETPOS=-1;BYMONTHDAY=26,27,28,29,30;BYDAY=MO,TU,WE,TH,FR


It needs to include the 26th-28th as the date could be as early as the 26th if the month is February in a non-leap year and the 28th is on a Sunday. That this doesn't appear to happen until 2021 is by the by.... 🙂 The last working day of the month is the 27th in February 2015.


And a RRULE for just the 15th part....


As we merged this with the other rule we can't use -1 as you did above. That would give the last date including the 26th-30th dates so would be the 30th more often than not. So we are counting forward 5 weekdays from the 9th.


...BYSETPOS=5;BYMONTHDAY=9,10,11,12,13,14,15;BYDAY=MO,TU,WE,TH,FR


As there are 7 dates in 9th-15th there will always be a weekend at some point in that date span. Say the weekend was the 11/12th, the count would be 9th, 10th, 13th, 14th, 15th which wouldbe a Wednesday. If the weekend was on the 8/9th (and 15/16th), the count would be 10, 11, 12, 13, 14, making the 5th weekday follwing the 9th to be Friday the 14th and so on...


That is why you need to the dates from the 9th. It is to allow two weekend dates to be always present in the date span, so the count will always work.


I'm not quite sure that this makes sense or is clear, let me know if not.


John M

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to setup single Pay Day Event

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.