It is currently April 25th, 2024, 4:15 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

Lua Calendar (Smurfier's) xml holiday question

Post by CodeCode »

Hello, saw this calendar here in the forums, and have really enjoyed it over the last calendar I was using.

Now, I am customising the holidays. All is well, so far. But the tricky question is: how would Boxing Day (first weekday after christmas) be written to this xml?

Code: Select all

 <!-- Event File v6.0 -->
 
 <EventFile Repeat="Year">
	<Variable Name="DayNumber" Select="86400"/>
	
	<!-- Built in Holidays. Add Inactive="true" to disable. -->
	<Event TimeStamp="({$Easter:Stamp}-2*{$DayNumber})">Good Friday</Event>
	<Event Month="{$Easter:Month}" Day="{$Easter:Day}">Easter Sunday</Event>
	<Event TimeStamp="({$Easter:Stamp}-46*{$DayNumber})">Ash Wednesday</Event>
	<Event TimeStamp="({$Easter:Stamp}-47*{$DayNumber})">MardiGras</Event>
	
	<!-- Normal Holidays -->
	<Set Month="1">
		<Event Day="1">New Years Day</Event>
		<Event Day="{$ThirdMon}">Martin Luther King, Jr. Day</Event>
	</Set>
	<Set Month="2">
		<Event Day="2">Groundhog Day</Event>
		<Event Day="14">Valentines Day</Event>
		<Event Day="{$ThirdMon}">Washington's Birthday</Event>
	</Set>
	<Event Month="3" Day="17">St. Patrick's Day</Event>
	<Set Month="4">
		<Event Day="1">April Fool's Day</Event>
		<Event Day="15">Tax Day</Event>
		<Event Day="22">Earth Day</Event>
		<Event Day="{$LastFri}">Arbor Day</Event>
	</Set>
	<Set Month="5">
		<Event Day="5">Cinco de Mayo</Event>
		<Event Day="{$SecondSun}">Mother's Day</Event>
		<Event Day="{$LastMon}">Memorial Day</Event>
	</Set>
	<Set Month="6">
		<Event Day="14">Flag Day</Event>
		<Event Day="{$ThirdSun}">Father's Day</Event>
	</Set>
	<Event Month="7" Day="4">Independence Day</Event>
	<Event Month="8" Day="26">Women's Equality Day</Event>
	<Set Month="9">
		<Event Day="{$FirstMon}">Labor Day</Event>
		<Event Day="({$FirstMon}+6)">Grandparent's Day</Event>
		<Event Day="11" Year="2001" Anniversary="true">Patriot Day</Event>
		<Event Day="17">Citizen Day</Event>
	</Set>
	<Set Month="10">
		<Event Day="9">Leif Erikson Day</Event>
		<Event Day="{$SecondMon}">Columbus Day</Event>
		<Event Day="31">Halloween</Event>
	</Set>
	<Set Month="11">
		<Event Day="(({$FirstMon}+1)*(({$Year}%2)=0))">Election Day</Event>
		<Event Day="11">Veterans Day</Event>
		<Event Day="{$FourthThu}">Thanksgiving Day</Event>
	</Set>
	<Set Month="12">
		<Event Day="7" Year="1941" Anniversary="true">Pearl Harbor Remembrance Day</Event>
		<Event Day="21">Winter Solstice</Event>
		<Event Day="24">Christmas Eve</Event>
		<Event Day="25">Christmas Day</Event>
		<Event Day="31">New Years Eve</Event>
	</Set>
</EventFile>
Thanks for any help.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

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

Post by Judian81 »

CodeCode wrote: September 6th, 2021, 5:30 am Hello, saw this calendar here in the forums, and have really enjoyed it over the last calendar I was using.

Now, I am customising the holidays. All is well, so far. But the tricky question is: how would Boxing Day (first weekday after christmas) be written to this xml?
this year the next weekend afther christmas falls in januari. cause christmas is in satureday and sunday.
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, 5:30 am Hello, saw this calendar here in the forums, and have really enjoyed it over the last calendar I was using.

Now, I am customising the holidays. All is well, so far. But the tricky question is: how would Boxing Day (first weekday after christmas) be written to this xml?

Code: Select all

 <!-- Event File v6.0 -->
 
 <EventFile Repeat="Year">
	<Variable Name="DayNumber" Select="86400"/>
	
	<!-- Built in Holidays. Add Inactive="true" to disable. -->
	<Event TimeStamp="({$Easter:Stamp}-2*{$DayNumber})">Good Friday</Event>
	<Event Month="{$Easter:Month}" Day="{$Easter:Day}">Easter Sunday</Event>
	<Event TimeStamp="({$Easter:Stamp}-46*{$DayNumber})">Ash Wednesday</Event>
	<Event TimeStamp="({$Easter:Stamp}-47*{$DayNumber})">MardiGras</Event>
	
	<!-- Normal Holidays -->
	<Set Month="1">
		<Event Day="1">New Years Day</Event>
		<Event Day="{$ThirdMon}">Martin Luther King, Jr. Day</Event>
	</Set>
	<Set Month="2">
		<Event Day="2">Groundhog Day</Event>
		<Event Day="14">Valentines Day</Event>
		<Event Day="{$ThirdMon}">Washington's Birthday</Event>
	</Set>
	<Event Month="3" Day="17">St. Patrick's Day</Event>
	<Set Month="4">
		<Event Day="1">April Fool's Day</Event>
		<Event Day="15">Tax Day</Event>
		<Event Day="22">Earth Day</Event>
		<Event Day="{$LastFri}">Arbor Day</Event>
	</Set>
	<Set Month="5">
		<Event Day="5">Cinco de Mayo</Event>
		<Event Day="{$SecondSun}">Mother's Day</Event>
		<Event Day="{$LastMon}">Memorial Day</Event>
	</Set>
	<Set Month="6">
		<Event Day="14">Flag Day</Event>
		<Event Day="{$ThirdSun}">Father's Day</Event>
	</Set>
	<Event Month="7" Day="4">Independence Day</Event>
	<Event Month="8" Day="26">Women's Equality Day</Event>
	<Set Month="9">
		<Event Day="{$FirstMon}">Labor Day</Event>
		<Event Day="({$FirstMon}+6)">Grandparent's Day</Event>
		<Event Day="11" Year="2001" Anniversary="true">Patriot Day</Event>
		<Event Day="17">Citizen Day</Event>
	</Set>
	<Set Month="10">
		<Event Day="9">Leif Erikson Day</Event>
		<Event Day="{$SecondMon}">Columbus Day</Event>
		<Event Day="31">Halloween</Event>
	</Set>
	<Set Month="11">
		<Event Day="(({$FirstMon}+1)*(({$Year}%2)=0))">Election Day</Event>
		<Event Day="11">Veterans Day</Event>
		<Event Day="{$FourthThu}">Thanksgiving Day</Event>
	</Set>
	<Set Month="12">
		<Event Day="7" Year="1941" Anniversary="true">Pearl Harbor Remembrance Day</Event>
		<Event Day="21">Winter Solstice</Event>
		<Event Day="24">Christmas Eve</Event>
		<Event Day="25">Christmas Day</Event>
		<Event Day="31">New Years Eve</Event>
	</Set>
</EventFile>
Thanks for any help.
http://smurfier.github.io/LuaCalendar/
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 »

Judian81 wrote: September 6th, 2021, 5:57 am this year the next weekend afther christmas falls in januari. cause christmas is in satureday and sunday.
THe first weekday after xmas is the 27th. A Monday.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
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, 6:42 am THe first weekday after xmas is the 27th. A Monday.
Wait. Boxing day is 26th Dec isn't it?
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, 6:53 am Wait. Boxing day is 26th Dec isn't it?
No. It is the next weekday after xmas. So this year xmas is a Saturday, boxing day is observed on monday.

So, if xmas was a monday, then tuesday would be boxing day. Since every year the calendar shifts by one day back, next year xmas is sunday, so boxing day will be monday again.

EDIT: the QLD google calendar is putting xmas in lieu for monday and tuesday is boxing day in lieu. Go figure that... :confused:

I am trying to find a vcariable that does {$FirstWeekday} but I am lost only getting through two versions that I havent completed yet, but trying..

<Event Day="{Christmas:Day}"{Next:Mon,Tue,Wed,Thu,Fri}">Boxing Day</Event>

<Event Month="{$Christmas:Month}" Day="{Christmas:Day}"
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

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

Post by Judian81 »

CodeCode wrote: September 6th, 2021, 6:42 am THe first weekday after xmas is the 27th. A Monday.
ow my bad.
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, 7:06 am
By weekdays you mean working days. So basically it becomes

Code: Select all

        <Set Month="12">
		<Event Day="7" Year="1941" Anniversary="true">Pearl Harbor Remembrance Day</Event>
		<Event Day="21">Winter Solstice</Event>
		<Event Day="24">Christmas Eve</Event>
		<Event Day="25">Christmas Day</Event>
		<Event Day="(26+({$FirstWed}=1)*1+({$FirstTue}=1)*2)" >Boxing Day</Event>
		<Event Day="31">New Years Eve</Event>
	</Set> 
Basically, if first day of December is Wednesday, Christmas will be in Saturday. So, we will skip Sunday by adding 1 to 26, that is date 27.

Similarly, if first day of December is Tuesday, we will skip Saturday and Sunday both by adding 2 to 26, that is date 28.

Else, it's just 26.

If your working days include Saturdays, you can remove the Tuesday conditional.

P.S. Lemme know if it works.
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, 7:31 am By weekdays you mean working days. So basically it becomes

Code: Select all

        <Set Month="12">
		<Event Day="7" Year="1941" Anniversary="true">Pearl Harbor Remembrance Day</Event>
		<Event Day="21">Winter Solstice</Event>
		<Event Day="24">Christmas Eve</Event>
		<Event Day="25">Christmas Day</Event>
		<Event Day="(26+({$FirstWed}=1)*1+({$FirstTue}=1)*2)" >Boxing Day</Event>
		<Event Day="31">New Years Eve</Event>
	</Set> 
Basically, if first day of December is Wednesday, Christmas will be in Saturday. So, we will skip Sunday by adding 1 to 26, that is date 27.

Similarly, if first day of December is Tuesday, we will skip Saturday and Sunday both by adding 2 to 26, that is date 28.

Else, it's just 26.

If your working days include Saturdays, you can remove the Tuesday conditional.

P.S. Lemme know if it works.
For all that is sane!? How the heck are able to get that into a one line equation!?

It looks good and I fast forwarded to 2023 so Ya, it works perfectly.

Perfectly. I wish I could say that for myself half as much as I say thanks to you death.crafter.
:party: :beer:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
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, 7:52 am For all that is sane!? How the heck are able to get that into a one line equation!?

It looks good and I fast forwarded to 2023 so Ya, it works perfectly.

Perfectly. I wish I could say that for myself half as much as I say thanks to you death.crafter.
:party: :beer:
Glad you got it working. And thanks for the beer :thumbup:

Only if you had looked at the documentation I linked more closely...
from the Realm of Death