It is currently April 26th, 2024, 11:25 am

Lua Calendar (Smurfier's) xml holiday question

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

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.

Code: Select all

<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)?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Lua Calendar (Smurfier's) xml holiday question

Post by death.crafter »

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.

Code: Select all

<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.

So the formula becomes:

Code: Select all

(1+({$FirstSun}=1)*1+({$FirstSat}=1)*2)
from the Realm of Death
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

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?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Lua Calendar (Smurfier's) xml holiday question

Post by death.crafter »

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.
from the Realm of Death
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

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.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

CodeCode wrote: September 6th, 2021, 8:50 am Yep that is correct. The only observed thing is for keeping a day off if the holiday is on a weekend.
Oh crap - i see what you mean!!!
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

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.

So the formula becomes:

Code: Select all

(1+({$FirstSun}=1)*1+({$FirstSat}=1)*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.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.