I am not very good with Javascript. I found the Easter function and Googled how to setup the rest. This script is in a function node that I use for my holiday lights. It used to work but now that I have changed some things, it doesn't. I found a script from Stack Overflow that figures out when the non-fixed date holidays are that I would like to implement but I would like to have a working base while I try to figure out.

A 0 or 1 is sent into the function node as the payload. Any help is greatly appreciated.

```
const d = new Date();
var day = d.getDay();
var year = d.getFullYear();
function Easter(Y) {
var C = Math.floor(Y/100);
var N = Y - 19*Math.floor(Y/19);
var K = Math.floor((C - 17)/25);
var I = C - Math.floor(C/4) - Math.floor((C - K)/3) + 19*N + 15;
I = I - 30*Math.floor((I/30));
I = I - Math.floor(I/28)*(1 - Math.floor(I/28)*Math.floor(29/(I + 1))*Math.floor((21 - N)/11));
var J = Y + Math.floor(Y/4) + I + 2 - C + Math.floor(C/4);
J = J - 7*Math.floor(J/7);
var L = I - J;
var M = 3 + Math.floor((L + 40)/44);
var D = L + 28 - 31*Math.floor(M/4);
return D
}
switch (d.getMonth() + 1) {
case 2: // Valentine's Day
if (day >= 7 && day <= 14) {
newMsg = { payload: msg.payload,output:1,select:1 };
return newMsg;
}
break;
case 3: // St. Patrick's Day
if (day >= 15 && day <= 17) {
newMsg = { payload: msg.payload,output:2,select:1 };
return newMsg;
}
break;
case 4: // Easter
var E = Easter(year);
if (day >= E - 2 && day <= E) {
newMsg = { payload: msg.payload,output:3,select:1 };
return newMsg;
}
break;
case 5: // Memorial Day
if (day >= 23 && day <= 25) {
newMsg = { payload: msg.payload,output:4,select:1 };
return newMsg;
}
break;
case 7: // 4th of July
if (day >= 1 && day <= 4) {
newMsg = { payload: msg.payload,output:5,select:1 };
return newMsg;
}
break;
case 10: // Halloween
if (day >= 1 && day <= 31) {
newMsg = { payload: msg.payload,output:6,select:1 };
return newMsg;
}
break;
case 11: // Thanksgiving
if (day >= 15 && day <= 17) {
newMsg = { payload: msg.payload,output:7,select:1 };
return newMsg;
}
break;
case 12: // Christmas
if (day >= 1 && day <= 31) {
newMsg = { payload: msg.payload,output:8,select:1 };
return newMsg;
}
break;
default:
newMsg = { payload: msg.payload,output:9,select:1 };
return newMsg;
}
```