Socket
Socket
Sign inDemoInstall

node-red-contrib-german-holidays

Package Overview
Dependencies
0
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

4

CHANGELOG.md
### CHANGELOG
#### 1.0.1 - maintenance
- added possibility to define additional payload data for a holiday or a special day. This could be used to directly send additional data based on the day which are today #10
#### 1.0.0 - maintenance

@@ -4,0 +8,0 @@

65

german-holidays.js

@@ -273,6 +273,7 @@ /********************************************

* @param {*} [characteristics] - characteristics of the day
* @param {*} [data] - additional data for the day
* @returns day
* @private
*/
function _newDay(id, date, name, nameAlt, character, characteristics) {
function _newDay(id, date, name, nameAlt, character, characteristics, data) {
if (!date) {

@@ -287,2 +288,3 @@ return null;

character,
data,
dayOfWeek: date.getDay(), // date.getUTCDay(),

@@ -348,3 +350,17 @@ day: date.getDate(), // date.getUTCDate(),

}
_pushUnique(outArr, _newDay(d.id, _makeDate(year, month, day), d.name, d.nameAlt, d.character, _getCharacterNames(d.character, characters)));
_pushUnique(
outArr,
_newDay(
d.id,
_makeDate(year, month, day),
d.name,
d.nameAlt,
d.character,
_getCharacterNames(d.character, characters),
{
type: d.plType,
value: d.plValue
}
)
);
}

@@ -413,2 +429,17 @@ });

// const node = this;
/**
* process special data
*/
this.getPayloadData = (data, msg) => {
if (data) {
if (data.type && data.value) {
try {
return RED.util.evaluateNodeProperty(data.value, data.type, this, msg);
} catch (err) {
this.error('Error getting additional data',err);
}
}
}
return null;
};

@@ -421,5 +452,6 @@ /**

* @param offsetToday (optional)
* @param msg the incomming message object
* @returns object of all information for the day
*/
this.getDataForDate = (date, daysObjects, offsetToday) => {
this.getDataForDate = (date, daysObjects, offsetToday, msg) => {
const d = date.getDay(); // gets the day of week

@@ -432,3 +464,4 @@ const result = _newDay(undefined, date, RED._('german-holidays.days.' + d), RED._('german-holidays.days.' + (d + 7)));

character: result.character,
characteristics: result.characteristics
characteristics: result.characteristics,
data: result.data
}];

@@ -457,2 +490,3 @@

result.nameAlt = result.holiday.nameAlt;
result.data = this.getPayloadData(result.holiday.data, msg);
} else if (result.isSpecialday) {

@@ -462,2 +496,3 @@ result.id = result.specialday.id;

result.nameAlt = result.specialday.nameAlt;
result.data = this.getPayloadData(result.specialday.data, msg);
}

@@ -485,10 +520,10 @@

*/
this.getDataForDay = (date, offsetToday, daysObjects) => {
this.getDataForDay = (date, offsetToday, daysObjects, msg) => {
if (offsetToday !== 0) {
const d = new Date(date);
d.setDate(d.getDate() + offsetToday);
return this.getDataForDate(d, daysObjects, offsetToday);
return this.getDataForDate(d, daysObjects, offsetToday, msg);
}
return this.getDataForDate(date, daysObjects, 0);
return this.getDataForDate(date, daysObjects, 0, msg);
};

@@ -582,3 +617,3 @@ const node = this;

const specialdays = _getSpecialDaysOfYear(this, outMsg.data.year);
outMsg.payload = this.getDataForDate(dto, specialdays);
outMsg.payload = this.getDataForDate(dto, specialdays, undefined, msg);
this.status({

@@ -601,3 +636,3 @@ fill: 'grey',

outMsg.payload = this.getDataForDay(outMsg.data.ts, outMsg.data.day, dataObjs);
outMsg.payload = this.getDataForDay(outMsg.data.ts, outMsg.data.day, dataObjs, msg);
this.status({

@@ -632,8 +667,10 @@ fill: 'grey',

};
outMsg.payload.yesterday = this.getDataForDay(outMsg.data.ts, -1, dayObjs);
outMsg.payload.today = this.getDataForDate(outMsg.data.ts, dayObjs, 0); // getDataForDay(outMsg.data.ts, 0, holidays);
outMsg.payload.tomorrow = this.getDataForDay(outMsg.data.ts, 1, dayObjs);
outMsg.payload.dayAfterTomorrow = this.getDataForDay(outMsg.data.ts, 2, dayObjs);
outMsg.payload.afterTheDayAfterTomorrow = this.getDataForDay(outMsg.data.ts, 3, dayObjs);
outMsg.payload.yesterday = this.getDataForDay(outMsg.data.ts, -1, dayObjs, msg);
outMsg.payload.today = this.getDataForDate(outMsg.data.ts, dayObjs, 0, msg); // getDataForDay(outMsg.data.ts, 0, holidays, msg);
outMsg.payload.tomorrow = this.getDataForDay(outMsg.data.ts, 1, dayObjs, msg);
outMsg.payload.dayAfterTomorrow = this.getDataForDay(outMsg.data.ts, 2, dayObjs, msg);
outMsg.payload.afterTheDayAfterTomorrow = this.getDataForDay(outMsg.data.ts, 3, dayObjs, msg);
outMsg.payload.data = outMsg.payload.today.data;
outMsg.payload.weekNumberEven = !(outMsg.payload.weekNumber % 2);

@@ -640,0 +677,0 @@

@@ -28,3 +28,4 @@ {

"nameAlt": "Alternativer Name",
"exampleDate": "beispielhaftes Datum:"
"exampleDate": "beispielhaftes Datum:",
"payload": "zus. Daten"
},

@@ -31,0 +32,0 @@ "placeholder": {

@@ -28,3 +28,4 @@ {

"nameAlt":"alternate name",
"exampleDate": "exemplary date:"
"exampleDate": "exemplary date:",
"payload": "add data"
},

@@ -31,0 +32,0 @@ "placeholder": {

{
"name": "node-red-contrib-german-holidays",
"version": "1.0.0",
"version": "1.0.1",
"description": "NodeRED nodes to get holidays or special days (not even german holidays)",

@@ -60,7 +60,7 @@ "keywords": [

"camo-purge": "^1.0.2",
"eslint": "^6.8.0",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-jsdoc": "^22.1.0",
"eslint": "^7.1.0",
"eslint-plugin-html": "^6.0.2",
"eslint-plugin-jsdoc": "^26.0.0",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-node": "^11.0.0"
"eslint-plugin-node": "^11.1.0"
},

@@ -67,0 +67,0 @@ "disabledSettings": {

@@ -20,3 +20,3 @@ # node-red-contrib-german-holidays for NodeRED

> - Requires Node-Red 1.0 or later!
> - Changed payload (holiday* instead of holliday*)!
> - Changed payload (holiday* instead of holiday*)!
> - Not configured Holidays will not be used (no backwards compatibility). Existing nodes needs to be opened, saved and deployed once!

@@ -76,2 +76,3 @@

- `dateISOString` _string_ the date of the day as ISO string.
- `data` _any_ optional only available if additional data is set.

@@ -105,2 +106,3 @@ ### enhanced day object **enh-day-object**

- (optional) `isBetweenWeekendOrHoliday` _string_ is true if the day is not a Saturday, Sunday or a holiday, but the day before or after is Saturday, Sunday or a holiday (only available on standard output for today, tomorrow and dayAfterTomorrow).
- (optional) `data` _any_ optional only available if additional data is set.

@@ -131,2 +133,3 @@ ### Output message object

- `msg.payload.weekNumberEven` _boolean_ Is `true` if the weekNumber is even.
- (optional) `msg.payload.data` _any_ is the same as `msg.payload.today.data` and only available if additional data is available for today.

@@ -151,2 +154,3 @@ ## Usage

### :moneybag: Donations [![Donate](https://img.shields.io/badge/donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=32NJPXPMR9YV8)
Even for those that don't have the technical knowhow to help developing on there are ways to support development. So if you want to donate some money please feel free to send money via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=32NJPXPMR9YV8).

@@ -166,3 +170,4 @@

this node is published also here:
- [NPM package](https://www.npmjs.com/package/node-red-contrib-german-holidays)
- [Node-Red](https://flows.nodered.org/node/node-red-contrib-german-holidays)
- [NPM package](https://www.npmjs.com/package/node-red-contrib-german-holidays)
- [Node-Red](https://flows.nodered.org/node/node-red-contrib-german-holidays)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc