Socket
Socket
Sign inDemoInstall

node-red-contrib-sun-position

Package Overview
Dependencies
1
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.7 to 0.1.8

42

nodes/lib/sunPosHelper.js

@@ -12,2 +12,3 @@ /********************************************

calcTimeValue,
calcTimeValueUTC,
getTimeOfText,

@@ -108,2 +109,39 @@ getTimeOfTextUTC,

let now = new Date();
d.setMilliseconds(0);
now.setMilliseconds(600); //security
let cmp = now.getTime();
if (d.getTime() <= cmp) {
d = d.addDays(Number(next));
}
}
if (days && (days !== '*') && (days !== '')) {
let daystart = d.getDay();
let dayx = 0;
let daypos = daystart;
while (days.indexOf(daypos) === -1) {
dayx += 1;
if ((daystart + dayx) > 6) {
daypos = (daystart * -1) + dayx - 1;
} else {
daypos = daystart + dayx;
}
if (dayx > 6) {
dayx = -1;
break;
}
}
if (dayx > 0) {
d = d.addDays(dayx);
}
}
return d;
}
/*******************************************************************************************************/
function calcTimeValueUTC(d, offset, next, days) {
//console.debug('calcTimeValueUTC d=' + d + ' offset=' + offset + ' next=' + next + ' days=' + days);
if (offset && !isNaN(offset) && offset !== 0) {
d = new Date(d.getTime() + offset * 1000); //- does not work
}
if (next && !isNaN(next)) {
let now = new Date();
d.setUTCMilliseconds(0);

@@ -186,3 +224,3 @@ now.setUTCMilliseconds(600); //security

}
return calcTimeValue(d, offset, next, days)
return calcTimeValueUTC(d, offset, next, days)
}

@@ -198,3 +236,3 @@ return null;

if (dto !== "Invalid Date" && !isNaN(dto)) {
return calcTimeValue(dto, offset, next, days);
return calcTimeValueUTC(dto, offset, next, days);
} else {

@@ -201,0 +239,0 @@ let result = getTimeOfTextUTC(String(date), tzOffset, offset, next, days);

2

package.json
{
"name": "node-red-contrib-sun-position",
"version": "0.1.7",
"version": "0.1.8",
"description": "NodeRED nodes to get sun and moon position",

@@ -5,0 +5,0 @@ "main": "none",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc