Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-sun-position

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-sun-position - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

7

CHANGELOG.md
# node-red-contrib-sun-position
#### 0.5.1-beta-0: BugFix and Maintenance Release
#### 0.5.2: BugFix
- general
- fix for error on getting tooltip #69
#### 0.5.1: BugFix and Maintenance Release
- general
- fix for week number calculation when in daylight saving #65

@@ -7,0 +12,0 @@ - if time output as object the week is now an extra object with properties

49

nodes/position-config.js

@@ -391,4 +391,4 @@ /********************************************

*/
getFloatProp(_srcNode, msg, type, value, def, opCallback) {
// _srcNode.debug('getFloatProp type='+type+' value='+value);
getFloatProp(_srcNode, msg, type, value, def, opCallback, noError) {
_srcNode.debug('getFloatProp type='+type+' value='+value);
let data; // 'msg', 'flow', 'global', 'num', 'bin', 'env', 'jsonata'

@@ -408,2 +408,3 @@ if (type === 'num') {

if (data === null || typeof data === 'undefined') {
if (noError) { return NaN; }
throw new Error(RED._('errors.error', { message: RED._('errors.notEvaluableProperty', {type, value}) }));

@@ -413,2 +414,3 @@ }

if (isNaN(data)) {
if (noError) { return NaN; }
throw new Error('the value of ' + type + '.' + value + ' is not a valid Number!');

@@ -446,3 +448,3 @@ }

if (data.value === '' || (typeof data.value === 'undefined')) {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = hlp.addOffset(now, offsetX, data.multiplier);

@@ -458,3 +460,3 @@ return hlp.getFormattedDateOut(result, data.format, (this.tzOffset === 0), this.tzOffset);

} else if (data.type === 'dateSpecific') {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = hlp.addOffset(now, offsetX, data.multiplier);

@@ -464,6 +466,6 @@ return hlp.getFormattedDateOut(result, data.format, (this.tzOffset === 0), this.tzOffset);

if (data.type === 'pdsTime') { // sun
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = this.getSunTimeByName(now, data.value, offsetX, data.multiplier, data.next, data.days);
} else if (data.type === 'pdmTime') { // moon
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = this.getMoonTimeByName(now, data.value, offsetX, data.multiplier, data.next, data.days);

@@ -479,3 +481,3 @@ }

result = hlp.getDateOfText(String(data.value), (this.tzOffset === 0), this.tzOffset);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = hlp.normalizeDate(result, offsetX, data.multiplier, data.next, data.days);

@@ -487,3 +489,3 @@ return hlp.getFormattedDateOut(result, data.format, (this.tzOffset === 0), this.tzOffset);

if (result !== null && typeof result !== 'undefined') {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = hlp.normalizeDate(result, offsetX, data.multiplier, data.next, data.days);

@@ -526,3 +528,3 @@ return hlp.getFormattedDateOut(result, data.format, (this.tzOffset === 0), this.tzOffset);

getTimeProp(_srcNode, msg, data) {
// _srcNode.debug(`getTimeProp data=${util.inspect(data, { colors: true, compact: 10, breakLength: Infinity })} tzOffset=${this.tzOffset}`);
_srcNode.debug(`getTimeProp data=${util.inspect(data, { colors: true, compact: 10, breakLength: Infinity })} tzOffset=${this.tzOffset}`);
let result = {

@@ -547,3 +549,3 @@ value: null,

} else if (data.type === 'dateSpecific') {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(now, offsetX, data.multiplier, data.next, data.days);

@@ -556,3 +558,3 @@ if (this.tzOffset) {

result.value = hlp.getSpecialDayOfMonth(now.getFullYear(), now.getMonth(), data.value);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(result.value, offsetX, data.multiplier, data.next, data.days);

@@ -565,3 +567,3 @@ if (this.tzOffset) {

if (result.value !== null) {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(result.value, offsetX, data.multiplier, data.next, data.days);

@@ -573,3 +575,3 @@ }

if (result.value !== null) {
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(result.value, offsetX, data.multiplier, data.next, data.days);

@@ -580,3 +582,3 @@ }

// sun
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = this.getSunTimeByName(now, data.value, offsetX, data.multiplier, data.next, data.days);

@@ -589,3 +591,3 @@ if (this.tzOffset) {

// moon
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result = this.getMoonTimeByName(now, data.value, offsetX, data.multiplier, data.next, data.days);

@@ -605,3 +607,3 @@ if (this.tzOffset) {

}
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(result.value, offsetX, data.multiplier, data.next, data.days);

@@ -621,3 +623,3 @@ if (this.tzOffset) {

}
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0);
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);
result.value = hlp.normalizeDate(result.value, offsetX, data.multiplier, data.next, data.days);

@@ -1115,3 +1117,3 @@ if (this.tzOffset) {

RED.httpAdmin.get('/sun-position/data', RED.auth.needsPermission('sun-position.read'), (req, res) => {
// console.log('RED.httpAdmin.get - result for getTimeData', req.query.config);
// console.log('RED.httpAdmin.get', req.query.config);
if (req.query.config && req.query.config !== '_ADD_') {

@@ -1125,2 +1127,9 @@ const posConfig = RED.nodes.getNode(req.query.config);

}
let scrNode;
if (req.query.nodeId) {
scrNode = RED.nodes.getNode(req.query.nodeId);
}
if (!scrNode) {
scrNode = posConfig;
}
let obj = {};

@@ -1130,3 +1139,3 @@ switch (req.query.kind) {

try {
obj = posConfig.getTimeProp(posConfig, undefined, req.query); // req.query.type, req.query.value, req.query.offsetType, req.query.offset, req.query.multiplier, req.query.next, req.query.days);
obj = posConfig.getTimeProp(scrNode, undefined, req.query); // req.query.type, req.query.value, req.query.offsetType, req.query.offset, req.query.multiplier, req.query.next, req.query.days);
} catch(err) {

@@ -1142,3 +1151,3 @@ obj.value = NaN;

try {
obj = posConfig.getOutDataProp(posConfig, undefined, req.query); // req.query.type, req.query.value, req.query.format, req.query.offset, req.query.offsetType, req.query.multiplier, req.query.next, req.query.days);
obj = posConfig.getOutDataProp(scrNode, undefined, req.query); // req.query.type, req.query.value, req.query.format, req.query.offset, req.query.offsetType, req.query.multiplier, req.query.next, req.query.days);
} catch(err) {

@@ -1145,0 +1154,0 @@ obj.value = NaN;

{
"name": "node-red-contrib-sun-position",
"version": "0.5.1",
"version": "0.5.2",
"description": "NodeRED nodes to get sun and moon position",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc