node-red-contrib-feiertage-germany
Advanced tools
Comparing version 1.5.6 to 1.6.0
@@ -1112,3 +1112,3 @@ /* eslint-disable prefer-destructuring */ | ||
function isTodayHoliday() { | ||
// outputs boolean wether today is holiday | ||
// outputs boolean whether today is holiday | ||
refreshHoliday(); // refresh holiday array | ||
@@ -1128,6 +1128,29 @@ let todayHoliday; | ||
} | ||
node.send({ payload: todayHoliday }); | ||
} | ||
node.send({ payload: todayHoliday }); | ||
} | ||
function isTomorrowHoliday() { | ||
// outputs boolean whether tomorrow is holiday | ||
refreshHoliday(); // refresh holiday array | ||
let tomorrowHoliday = false; | ||
if (holiday.length !== 0) { | ||
const tomorrowDate = new Date(); | ||
tomorrowDate.setDate(tomorrowDate.getDate() + 1); | ||
for (let i = 0; i < holiday.length; i += 1) { | ||
const element = holiday[i]; | ||
const holidayDate = new Date(element.dateObj); | ||
if ( | ||
holidayDate.getFullYear() === tomorrowDate.getFullYear() | ||
&& holidayDate.getMonth() === tomorrowDate.getMonth() | ||
&& holidayDate.getDate() === tomorrowDate.getDate() | ||
) { | ||
tomorrowHoliday = true; | ||
break; | ||
} | ||
} | ||
} | ||
node.send({ payload: tomorrowHoliday }); | ||
} | ||
function sendNextHoliday() { | ||
@@ -1167,5 +1190,4 @@ // outputs next holiday | ||
function isChristmasTime() { | ||
if (new Date(Feiertage.getAdvent1( | ||
Feiertage.formatDateObj, currentYear, | ||
)).valueOf() <= new Date().valueOf() | ||
if (new Date(Feiertage.getAdvent1(Feiertage.formatDateObj, currentYear)).valueOf() | ||
<= new Date().valueOf() | ||
&& new Date(Feiertage.getSilvester( | ||
@@ -1175,5 +1197,4 @@ Feiertage.formatDateObj, currentYear, | ||
node.send({ payload: true }); | ||
} else if (new Date(Feiertage.getNeujahr( | ||
Feiertage.formatDateObj, currentYear, | ||
)).valueOf() <= new Date().valueOf() | ||
} else if (new Date(Feiertage.getNeujahr(Feiertage.formatDateObj, currentYear)).valueOf() | ||
<= new Date().valueOf() | ||
&& new Date(Feiertage.getHeiligeDreiKoenige( | ||
@@ -1205,2 +1226,5 @@ Feiertage.formatDateObj, currentYear, | ||
break; | ||
case 'isTomorrowHoliday': | ||
isTomorrowHoliday(); | ||
break; | ||
case 'nextHoliday': | ||
@@ -1238,3 +1262,4 @@ sendNextHoliday(); | ||
} | ||
RED.nodes.registerType('feiertageDE', feiertageDE); | ||
}; |
@@ -30,3 +30,3 @@ { | ||
}, | ||
"version": "1.5.6", | ||
"version": "1.6.0", | ||
"bugs": { | ||
@@ -33,0 +33,0 @@ "url": "https://github.com/MariusLang/node-red-contrib-feiertage-germany/issues" |
![banner](img/feiertage_banner_de.svg) | ||
# Node Red Feiertage Germany | ||
@@ -10,19 +11,21 @@ | ||
The Node Red **Feiertage Germany** node is the ultimative node to get informations about german holidays. | ||
The Node Red **Feiertage Germany** node is the ultimate node to get information about german holidays. | ||
Is there any holiday missing? Write an issue! I'm going to add this holiday for you. | ||
This node was splitted out of the [node-red-contrib-feiertage](https://github.com/MariusLang/node-red-contrib-feiertage) node. This Node only contains **German** holidays. | ||
To get this node for an other country read the point below. | ||
This node was split out of the [node-red-contrib-feiertage](https://github.com/MariusLang/node-red-contrib-feiertage) | ||
node. This Node only contains **German** holidays. | ||
To get this node for another country read the point below. | ||
## You're living in Germany, Austria or Switzerland? | ||
country | node-red node | ||
--- | --- | ||
Germany | [node-red-contrib-feiertage-germany](https://github.com/MariusLang/node-red-contrib-feiertage-germany) | ||
Austria | [node-red-contrib-feiertage-austria](https://github.com/MariusLang/node-red-contrib-feiertage-austria) | ||
Switzerland | [node-red-contrib-feiertage-switzerland](https://github.com/MariusLang/node-red-contrib-feiertage-switzerland) | ||
Or you want all in one node (Germany, Austria, Switzerland) | [node-red-contrib-feiertage](https://github.com/MariusLang/node-red-contrib-feiertage) | ||
| country | node-red node | | ||
|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------| | ||
| Germany | [node-red-contrib-feiertage-germany](https://github.com/MariusLang/node-red-contrib-feiertage-germany) | | ||
| Austria | [node-red-contrib-feiertage-austria](https://github.com/MariusLang/node-red-contrib-feiertage-austria) | | ||
| Switzerland | [node-red-contrib-feiertage-switzerland](https://github.com/MariusLang/node-red-contrib-feiertage-switzerland) | | ||
| Or you want all in one node (Germany, Austria, Switzerland) | [node-red-contrib-feiertage](https://github.com/MariusLang/node-red-contrib-feiertage) | | ||
## Installation | ||
``` | ||
@@ -33,4 +36,6 @@ npm install node-red-contrib-feiertage-germany | ||
## Getting Started | ||
At first, it's important to check that you have picked the rigth localisation and timezone on your device. Below you can find a manual how to change those settings on to a RaspberryPi. | ||
At first, it's important to check that you have picked the right localisation and timezone on your device. Below you can | ||
find a manual how to change those settings on to a RaspberryPi. | ||
Login into your Pi. Then open the settings with this command. | ||
@@ -52,3 +57,3 @@ | ||
After you have finished setup click **Finish**. | ||
To make your changes valid reboot your pi. | ||
To make your changes valid reboot your pi. | ||
@@ -62,15 +67,19 @@ ``` | ||
### Input | ||
The input can be used to trigger special outputs. The keywords are listed below. | ||
msg.payload | output | ||
--- | --- | ||
isTodayHoliday | boolean wether today is holiday | ||
isChristmasTime | boolean wether today is Christmas time (1. Advent - Heilige drei Könige) | ||
nextHoliday | information about next holiday | ||
nextThreeHolidays | informations about next 3 holidays | ||
all | informations about all holidays | ||
| msg.payload | output | | ||
|-------------------|---------------------------------------------------------------------------| | ||
| isTodayHoliday | boolean whether today is holiday | | ||
| isChristmasTime | boolean whether today is Christmas time (1. Advent - Heilige drei Könige) | | ||
| nextHoliday | information about next holiday | | ||
| nextThreeHolidays | information about next 3 holidays | | ||
| all | information about all holidays | | ||
### Output | ||
The output can be used to listen to automatic and user triggered events. Every day at 00:01 o'clock the node automaticly outputs a boolean value wether today is a holiday. | ||
The output can be used to listen to automatic and user triggered events. Every day at 00:01 o'clock the node | ||
automatically | ||
outputs a boolean value whether today is a holiday. | ||
You decide what you want to receive: Object or Array! | ||
@@ -81,17 +90,17 @@ To enable output as array open the node settings and hit the checkbox **output: Array instead of Object** at the bottom. | ||
key | output | ||
--- | --- | ||
id | id | ||
name | name | ||
dateObj | date (yyyy-mm-dd) | ||
dateDE | german date (dd.mm.yyyy) | ||
| key | output | | ||
|---------|--------------------------| | ||
| id | id | | ||
| name | name | | ||
| dateObj | date (yyyy-mm-dd) | | ||
| dateDE | german date (dd.mm.yyyy) | | ||
holiday array[3] output: | ||
index | output | ||
--- | --- | ||
0 | id | ||
1 | name | ||
2 | date (yyyy-mm-dd) | ||
3 | german date (dd.mm.yyyy) | ||
| index | output | | ||
|-------|--------------------------| | ||
| 0 | id | | ||
| 1 | name | | ||
| 2 | date (yyyy-mm-dd) | | ||
| 3 | german date (dd.mm.yyyy) | | ||
@@ -101,13 +110,18 @@ Every day at 12 am you will receive a boolean value whether today is a holiday if daily output is enabled. | ||
### Own Holidays | ||
You can chose up to 10 own dates. Select the **day** in the first dropdown-menu and the **month** in the second. Chose a name for your holiday and type it into the input field. Don't forget to hit the checkbox to enable your own holiday. Pay attention: The node does NOT validate your own dates. So if you set the 30 febrary or the 31 april as date you wont't get an error message. | ||
You can choose up to 10 own dates. Select the **day** in the first dropdown-menu and the **month** in the second. Chose | ||
a name for your holiday and type it into the input field. Don't forget to hit the checkbox to enable your own holiday. | ||
Pay attention: The node does NOT validate your own dates. So if you set the 30 february or the 31 april as date you | ||
won't get an error message. | ||
![own_holiday_example](img/own_holiday_example.PNG) | ||
## Example Flow | ||
You can import this example into your Node Red flow. | ||
![flow_example](img/flow_example.PNG) | ||
![flow_example](img/flow_example.png) | ||
``` | ||
[{"id":"f1b9a910.cde22","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nextHoliday","payloadType":"str","x":330,"y":260,"wires":[["b33bd49e010f2b92"]]},{"id":"a1e6e4e7.6428b8","type":"debug","z":"d92a1f96.826db","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":320,"wires":[]},{"id":"28a89e40.c6e7f2","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"isTodayHoliday","payloadType":"str","x":320,"y":220,"wires":[["b33bd49e010f2b92"]]},{"id":"436a9296.ac9d64","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nextThreeHolidays","payloadType":"str","x":310,"y":300,"wires":[["b33bd49e010f2b92"]]},{"id":"7bc106b4.fd56","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"all","payloadType":"str","x":350,"y":340,"wires":[["b33bd49e010f2b92"]]},{"id":"8369dae3.962ed","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"isChristmasTime","payloadType":"str","x":320,"y":380,"wires":[["b33bd49e010f2b92"]]},{"id":"b33f57df.41c96","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"daysUntilNextHoliday","payloadType":"str","x":310,"y":420,"wires":[["b33bd49e010f2b92"]]},{"id":"b33bd49e010f2b92","type":"feiertageDE","z":"d92a1f96.826db","name":"Feiertage DE","local":"DE","neujahr":true,"neujahrName":"Neujahr","heiligeDreiKoenige":true,"heiligeDreiKoenigeName":"Heilige drei Könige","weiberfastnacht":true,"weiberfastnachtName":"Weiberfastnacht","valentinstag":true,"valentinstagName":"Valentinstag","rosenmontag":true,"rosenmontagName":"Rosenmontag","fastnachtsdienstag":true,"fastnachtsdienstagName":"Fastnachtdienstag","aschermittwoch":true,"aschermittwochName":"Aschermittwoch","gruendonnerstag":true,"gruendonnerstagName":"Gründonnerstag","karfreitag":true,"karfreitagName":"Karfreitag","easterSunday":true,"easterSundayName":"Ostersonntag","easterMonday":true,"easterMondayName":"Ostermontag","firstMay":true,"firstMayName":"1. Mai","christiHimmelfahrt":true,"christiHimmelfahrtName":"Christi Himmelfahrt","pfingstsonntag":true,"pfingstsonntagName":"Pfingstsonntag","pfingstmontag":true,"pfingstmontagName":"Pfingstmontag","fronleichnam":true,"fronleichnamName":"Fronleichnam","mariaHimmelfahrt":true,"mariaHimmelfahrtName":"Maria Himmelfahrt","tagDerDeutschenEinheit":true,"tagDerDeutschenEinheitName":"Tag der Deutschen Einheit","halloween":true,"halloweenName":"Halloween","allerheiligen":true,"allerheiligenName":"Allerheiligen","stMartin":true,"stMartinName":"St. Martin","bussUndBettag":true,"bussUndBettagName":"Buß und Bettag","nikolaus":true,"nikolausName":"Nikolaus","advent1":true,"advent1Name":"1. Advent","advent2":true,"advent2Name":"2. Advent","advent3":true,"advent3Name":"3. Advent","advent4":true,"advent4Name":"4. Advent","heiligabend":true,"heiligabendName":"Heiligabend","weihnachten1":true,"weihnachten1Name":"1. Weihnachtsfeiertag","weihnachten2":true,"weihnachten2Name":"2. Weihnachtsfeiertag","silvester":true,"silvesterName":"Silvester","ownHoliday1":false,"ownHoliday1Day":1,"ownHoliday1Month":1,"ownHoliday1Name":"own Date 1","ownHoliday2":false,"ownHoliday2Day":2,"ownHoliday2Month":2,"ownHoliday2Name":"own Date 2","ownHoliday3":false,"ownHoliday3Day":3,"ownHoliday3Month":3,"ownHoliday3Name":"own Date 3","ownHoliday4":false,"ownHoliday4Day":4,"ownHoliday4Month":4,"ownHoliday4Name":"own Date 4","ownHoliday5":false,"ownHoliday5Day":5,"ownHoliday5Month":5,"ownHoliday5Name":"own Date 5","ownHoliday6":false,"ownHoliday6Day":6,"ownHoliday6Month":6,"ownHoliday6Name":"own Date 6","ownHoliday7":false,"ownHoliday7Day":7,"ownHoliday7Month":7,"ownHoliday7Name":"own Date 7","ownHoliday8":false,"ownHoliday8Day":8,"ownHoliday8Month":8,"ownHoliday8Name":"own Date 8","ownHoliday9":false,"ownHoliday9Day":9,"ownHoliday9Month":9,"ownHoliday9Name":"own Date 9","ownHoliday10":false,"ownHoliday10Day":10,"ownHoliday10Month":10,"ownHoliday10Name":"own Date 10","array":false,"dailyOutput":true,"x":540,"y":320,"wires":[["a1e6e4e7.6428b8"]]}] | ||
``` | ||
[{"id":"12b97870218b4c6b","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nextHoliday","payloadType":"str","x":170,"y":800,"wires":[["c9f7f4771901bc57"]]},{"id":"5394aa2cf3efec31","type":"debug","z":"d92a1f96.826db","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":840,"wires":[]},{"id":"7d8ee4d238acf1b7","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"isTodayHoliday","payloadType":"str","x":160,"y":720,"wires":[["c9f7f4771901bc57"]]},{"id":"f04512eaa5f19f68","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nextThreeHolidays","payloadType":"str","x":150,"y":840,"wires":[["c9f7f4771901bc57"]]},{"id":"acdb506597b542db","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"all","payloadType":"str","x":190,"y":880,"wires":[["c9f7f4771901bc57"]]},{"id":"9d6422a4f0cbc881","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"isChristmasTime","payloadType":"str","x":160,"y":920,"wires":[["c9f7f4771901bc57"]]},{"id":"7730c7a58df4ad65","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"daysUntilNextHoliday","payloadType":"str","x":150,"y":960,"wires":[["c9f7f4771901bc57"]]},{"id":"b6bdd27b03a9ab5f","type":"inject","z":"d92a1f96.826db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"isTomorrowHoliday","payloadType":"str","x":150,"y":760,"wires":[["c9f7f4771901bc57"]]},{"id":"c9f7f4771901bc57","type":"feiertageDE","z":"d92a1f96.826db","name":"Feiertage DE","local":"DE","neujahr":true,"neujahrName":"Neujahr","heiligeDreiKoenige":true,"heiligeDreiKoenigeName":"Heilige drei Könige","weiberfastnacht":true,"weiberfastnachtName":"Weiberfastnacht","valentinstag":true,"valentinstagName":"Valentinstag","rosenmontag":true,"rosenmontagName":"Rosenmontag","fastnachtsdienstag":true,"fastnachtsdienstagName":"Fastnachtdienstag","aschermittwoch":true,"aschermittwochName":"Aschermittwoch","gruendonnerstag":true,"gruendonnerstagName":"Gründonnerstag","karfreitag":true,"karfreitagName":"Karfreitag","easterSunday":true,"easterSundayName":"Ostersonntag","easterMonday":true,"easterMondayName":"Ostermontag","firstMay":true,"firstMayName":"1. Mai","christiHimmelfahrt":true,"christiHimmelfahrtName":"Christi Himmelfahrt","pfingstsonntag":true,"pfingstsonntagName":"Pfingstsonntag","pfingstmontag":true,"pfingstmontagName":"Pfingstmontag","fronleichnam":true,"fronleichnamName":"Fronleichnam","mariaHimmelfahrt":true,"mariaHimmelfahrtName":"Maria Himmelfahrt","tagDerDeutschenEinheit":true,"tagDerDeutschenEinheitName":"Tag der Deutschen Einheit","halloween":true,"halloweenName":"Halloween","allerheiligen":true,"allerheiligenName":"Allerheiligen","stMartin":true,"stMartinName":"St. Martin","bussUndBettag":true,"bussUndBettagName":"Buß und Bettag","nikolaus":true,"nikolausName":"Nikolaus","advent1":true,"advent1Name":"1. Advent","advent2":true,"advent2Name":"2. Advent","advent3":true,"advent3Name":"3. Advent","advent4":true,"advent4Name":"4. Advent","heiligabend":true,"heiligabendName":"Heiligabend","weihnachten1":true,"weihnachten1Name":"1. Weihnachtsfeiertag","weihnachten2":true,"weihnachten2Name":"2. Weihnachtsfeiertag","silvester":true,"silvesterName":"Silvester","ownHoliday1":true,"ownHoliday1Day":"28","ownHoliday1Month":"12","ownHoliday1Name":"own Date 1","ownHoliday2":false,"ownHoliday2Day":2,"ownHoliday2Month":2,"ownHoliday2Name":"own Date 2","ownHoliday3":false,"ownHoliday3Day":3,"ownHoliday3Month":3,"ownHoliday3Name":"own Date 3","ownHoliday4":false,"ownHoliday4Day":4,"ownHoliday4Month":4,"ownHoliday4Name":"own Date 4","ownHoliday5":false,"ownHoliday5Day":5,"ownHoliday5Month":5,"ownHoliday5Name":"own Date 5","ownHoliday6":false,"ownHoliday6Day":6,"ownHoliday6Month":6,"ownHoliday6Name":"own Date 6","ownHoliday7":false,"ownHoliday7Day":7,"ownHoliday7Month":7,"ownHoliday7Name":"own Date 7","ownHoliday8":false,"ownHoliday8Day":8,"ownHoliday8Month":8,"ownHoliday8Name":"own Date 8","ownHoliday9":false,"ownHoliday9Day":9,"ownHoliday9Month":9,"ownHoliday9Name":"own Date 9","ownHoliday10":false,"ownHoliday10Day":10,"ownHoliday10Month":10,"ownHoliday10Name":"own Date 10","array":false,"dailyOutput":true,"x":420,"y":840,"wires":[["5394aa2cf3efec31"]]}] | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242156
1172
122