Ok, so now after looking at the calendar, I am trying to do the sme thing for New Years Day observed - which would be the same thing. but using the form you provided, I am not getting the same result.
<Event Day="(1+({$FirstSat}=1)*1+({$FirstFri}=1)*2)">New Years Day [ob]</Event>
That just says [ob] is on Sunday, not instead as I would say should be Monday. Sorry for being slow here, but wouldnt this be correct? (as per above snippet)?
CodeCode wrote: ↑September 6th, 2021, 8:18 am
Ok, so now after looking at the calendar, I am trying to do the sme thing for New Years Day observed - which would be the same thing. but using the form you provided, I am not getting the same result.
<Event Day="(1+({$FirstSat}=1)*1+({$FirstFri}=1)*2)">New Years Day [ob]</Event>
That just says [ob] is on Sunday, not instead as I would say should be Monday. Sorry for being slow here, but wouldnt this be correct? (as per above snippet)?
Actually, the logic is flawed.
If first day of Jan is Sunday you skip 1 day. And if first day is Saturday you skip 2.
How the Christmas gets calculated is, if first day is Wednesday then 26th would be Sunday. So we add 1 to 26 to get to Monday.
So what we need is the day of the date we are after. So that means we need the day of 1 Jan. If 1 Jan is Sunday, we add 1 and if it's Saturday we add 2.
CodeCode wrote: ↑September 6th, 2021, 8:35 am
Hey, I did it this way, and it seems to work: <Event Day="1+(1+({$FirstSat}=1)*1+({$FirstFri}=1)*2)">New Years Day [ob]</Event>
Is this a kludge? Or is it just a different way of doing the same?
I don't think it works. It will give second of Jan as the date, even if the first of Jan is a working day.
death.crafter wrote: ↑September 6th, 2021, 8:38 am
I don't think it works. It will give second of Jan as the date, even if the first of Jan is a working day.
Yep that is correct. The only observed thing is for keeping a day off if the holiday is on a weekend.
death.crafter wrote: ↑September 6th, 2021, 8:33 am
Actually, the logic is flawed.
If first day of Jan is Sunday you skip 1 day. And if first day is Saturday you skip 2.
How the Christmas gets calculated is, if first day is Wednesday then 26th would be Sunday. So we add 1 to 26 to get to Monday.
So what we need is the day of the date we are after. So that means we need the day of 1 Jan. If 1 Jan is Sunday, we add 1 and if it's Saturday we add 2.
Thank you - sometimes this sort of logic gets the better of me. That and the xml formatting had me really confused. But this is something I will probably need tot do again, so it serves as a great example of what can be done in xml.