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.4.4 to 0.4.5

11

CHANGELOG.md

@@ -0,1 +1,12 @@

#### 0.4.5: Maintenance Release
- time-compare
- node added option "otherwise"
- time-span
- node added option "otherwise"
- fixed error time-span output
- dayOfMonth
- fixed wrong entry in type edit
- fixed exception on empty date in offset calculation
#### 0.4.4: Maintenance Release

@@ -2,0 +13,0 @@

8

nodes/locales/de/position-config.json

@@ -19,3 +19,3 @@ {

"timeentered": "Uhrzeit (nächste)",
"dateentered": "Datum (Zeitpunkt)",
"dateentered": "Datum (spezieller Zeitpunkt)",
"timepredefined": "Uhrzeit speziell",

@@ -85,3 +85,4 @@ "dayofmonth": "Monatstag",

"operatorsGroups": [
"kompletter Zeitpunkt"
"Zeitpunkt Vergleich",
"anderes"
],

@@ -94,3 +95,4 @@ "operators": [

"< (kleiner)",
"<= (kleiner or gleich)"
"<= (kleiner or gleich)",
"Andernfalls"
],

@@ -97,0 +99,0 @@ "operatorTypesGroups": [

@@ -84,3 +84,4 @@ {

"operatorsGroups": [
"complete Timestamp"
"Timestamp compare",
"other"
],

@@ -93,3 +94,4 @@ "operators": [

"< (lesser)",
"<= (lesser or equal)"
"<= (lesser or equal)",
"otherwise"
],

@@ -96,0 +98,0 @@ "operatorTypesGroups": [

@@ -9,3 +9,4 @@ /************************************************************************/

operatorsGroups: [
{id: 'default', label: 'compare Timestamp'}
{id: 'default', label: 'compare Timestamp'},
{ id: 'other', label: 'always'}
],

@@ -18,3 +19,4 @@ operators: [

{id: 5, group: 'default', label: '<', text: 'lesser'},
{id: 6, group: 'default', label: '<=', text: 'lesser or equal'}
{id: 6, group: 'default', label: '<=', text: 'lesser or equal'},
{id: 99, group: 'other', label: 'otherwise', text: 'otherwise'}
], operatorTypesGroups: [

@@ -191,8 +193,5 @@ {id: 'default', label: 'include into compare'},

DayOfMonth: {
value: 'DayOfMonth',
value: 'dayOfMonth',
label: node._('node-red-contrib-sun-position/position-config:common.types.dayofmonth','day of month'),
options: [{
value: 'astronomicalDawn',
label: node._('node-red-contrib-sun-position/position-config:common.typeOptions.astronomicalDawn')
}, {
value: 'fMon',

@@ -792,9 +791,9 @@ label: node._('node-red-contrib-sun-position/position-config:common.typeOptions.fMon')

if (value === '*' || typeof value === 'undefined') {
field.find('#option-checkboxes input[type=checkbox]').prop('checked', true);
field.find('.option-checkboxes input[type=checkbox]').prop('checked', true);
field.find('.multiselect-option').text(getMultiselectText('*', 99, types));
} else {
field.find('#option-checkboxes input[type=checkbox]').removeAttr('checked');
field.find('.option-checkboxes input[type=checkbox]').removeAttr('checked');
const elm = value.split(',');
elm.forEach(v => {
field.find('#option-checkboxes [value=' + v + ']').prop('checked', true);
field.find('.option-checkboxes [value=' + v + ']').prop('checked', true);
});

@@ -817,3 +816,3 @@ field.find('.multiselect-option').text(getMultiselectText(value, elm.length, types));

const getSelection = function getCBText(parent) {
const value = parent.find('#option-checkboxes input[type=checkbox]:checked');
const value = parent.find('.option-checkboxes input[type=checkbox]:checked');
const elements = value.map((_, el) => { return $(el).val(); }).get();

@@ -826,3 +825,3 @@ parent.find('.multiselect-option').text(getMultiselectText(elements.join(','), elements.length, types));

html: $('<select/>', {
id: 'multiselect-select',
id: id+'multiselect-select',
class: 'multiselect-select',

@@ -837,3 +836,3 @@ html: $('<option></option>', {

const list = $('<div/>', {
id: 'option-checkboxes',
id: id +'option-checkboxes',
class: 'option-checkboxes'

@@ -840,0 +839,0 @@ }).appendTo(multiselect);

@@ -100,27 +100,6 @@ /********************************************

}
/* const ruleoperand = node.positionConfig.getDateFromProp(node, msg, rule.operandType, rule.operandValue, rule.format, rule.offsetValue, 'num', rule.multiplier);
if (!ruleoperand) {
continue;
} */
let ruleoperand = null;
try {
ruleoperand = node.positionConfig.getTimeProp(node, msg, {
type: rule.operandType,
value: rule.operandValue,
format: rule.format,
offsetType: 'num',
offset: rule.offsetValue,
multiplier: rule.multiplier
});
} catch (ex) {
continue;
}
if (!ruleoperand || ruleoperand.error) {
continue;
}
ruleoperand = ruleoperand.value;
// node.debug('operand=' + util.inspect(ruleoperand, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug('operator=' + util.inspect(rule.operator, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' rule=' + util.inspect(rule, { colors: true, compact: 10, breakLength: Infinity }));
let compare = null;
let result = false;
switch (Number(rule.operator)) {

@@ -145,9 +124,31 @@ case 1: // equal { id: 1, group: "ms", label: "==", "text": "equal" },

break;
case 99: // otherwise
result = true;
break;
}
let result = false;
if (compare) {
let ruleoperand = null;
try {
ruleoperand = node.positionConfig.getTimeProp(node, msg, {
type: rule.operandType,
value: rule.operandValue,
format: rule.format,
offsetType: 'num',
offset: rule.offsetValue,
multiplier: rule.multiplier
});
} catch (ex) {
continue;
}
// node.debug(i + ' operand=' + util.inspect(ruleoperand, { colors: true, compact: 10, breakLength: Infinity }));
if (!ruleoperand || ruleoperand.error) {
continue;
}
ruleoperand = ruleoperand.value;
const inputOperant = new Date(inputData.value);
// node.debug('inputOperant=' + util.inspect(inputOperant, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug('operatorType=' + util.inspect(rule.operatorType, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' inputOperant=' + util.inspect(inputOperant, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' operatorType=' + util.inspect(rule.operatorType, { colors: true, compact: 10, breakLength: Infinity }));
if (rule.operatorType !== '*' && typeof rule.operatorType !== 'undefined') {

@@ -215,2 +216,5 @@ switch (rule.operatorType) {

// node.debug(i + ' inputOperant=' + util.inspect(inputOperant, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' ruleoperand=' + util.inspect(ruleoperand, { colors: true, compact: 10, breakLength: Infinity }));
result = compare(inputOperant.getTime(), ruleoperand.getTime());

@@ -220,10 +224,10 @@ if (rule.operatorType.indexOf('18') >= 0) {

}
// node.debug('inputData=' + util.inspect(inputData, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug('operand=' + util.inspect(ruleoperand, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' result=' + util.inspect(result, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' inputData=' + util.inspect(inputData, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug(i + ' operand=' + util.inspect(ruleoperand, { colors: true, compact: 10, breakLength: Infinity }));
break;
}
// node.debug('result=' + util.inspect(result, { colors: true, compact: 10, breakLength: Infinity }));
}
}
// node.debug(i + ' result=' + util.inspect(result, { colors: true, compact: 10, breakLength: Infinity }));

@@ -230,0 +234,0 @@ if (result) {

@@ -170,3 +170,5 @@ /********************************************

*/
function getFormattedTimeSpanOut(date1, date2, format) {
function getFormattedTimeSpanOut(node, date1, date2, format) {
const timeSpan = date1.getTime() - date2.getTime();
format = format || 0;

@@ -177,14 +179,12 @@ if (isNaN(format)) {

switch (Number(format)) {
case 0: // milliseconds
return (date1.getTime() - date2.getTime());
case 1: // sec
return (date1.getTime() - date2.getTime()) / perSecond;
return (timeSpan) / perSecond;
case 2: // min
return (date1.getTime() - date2.getTime()) / perMinute;
return (timeSpan) / perMinute;
case 3: // hour
return (date1.getTime() - date2.getTime()) / perHour;
return (timeSpan) / perHour;
case 4: // days
return (date1.getTime() - date2.getTime()) / perDay;
return (timeSpan) / perDay;
case 5: // weeks
return (date1.getTime() - date2.getTime()) / perWeek;
return (timeSpan) / perWeek;
case 6: // month

@@ -201,11 +201,11 @@ if (date1.getTime() > date2.getTime()) {

case 11: // sec
return Math.floor((date1.getTime() - date2.getTime()) / perSecond);
return Math.floor((timeSpan) / perSecond);
case 12: // min
return Math.floor((date1.getTime() - date2.getTime()) / perMinute);
return Math.floor((timeSpan) / perMinute);
case 13: // hour
return Math.floor((date1.getTime() - date2.getTime()) / perHour);
return Math.floor((timeSpan) / perHour);
case 14: // days
return Math.floor((date1.getTime() - date2.getTime()) / perDay);
return Math.floor((timeSpan) / perDay);
case 15: // weeks
return Math.floor((date1.getTime() - date2.getTime()) / perWeek);
return Math.floor((timeSpan) / perWeek);
case 16: // full month

@@ -222,3 +222,3 @@ if (date1.getTime() > date2.getTime()) {

}
const timeSpan = date1.getTime() - date2.getTime();
return {

@@ -229,3 +229,5 @@ start : {

timeUTCStr: date1.toUTCString(),
timeISOStr: date1.toISOString()
timeISOStr: date1.toISOString(),
timeLocaleTimeStr: node.positionConfig.toTimeString(date1),
timeLocaleDateStr: node.positionConfig.toDateString(date1)
},

@@ -236,3 +238,5 @@ end: {

timeUTCStr: date2.toUTCString(),
timeISOStr: date2.toISOString()
timeISOStr: date2.toISOString(),
timeLocaleTimeStr: node.positionConfig.toTimeString(date2),
timeLocaleDateStr: node.positionConfig.toDateString(date2)
},

@@ -319,3 +323,6 @@ timeSpan,

let timeSpan = operand1.getTime() - operand2.getTime();
// node.debug('operand1=' + util.inspect(operand1, { colors: true, compact: 10, breakLength: Infinity }));
// node.debug('operand2=' + util.inspect(operand2, { colors: true, compact: 10, breakLength: Infinity }));
let timeSpan = operand1.value.getTime() - operand2.value.getTime();
if (config.operand === 0) {

@@ -328,7 +335,3 @@ timeSpan = Math.abs(timeSpan);

if (config.result1ValueType === 'timespan') {
resultObj = getFormattedTimeSpanOut(operand1.value, operand2.value, config.result1TSFormat);
resultObj.start.timeLocaleTimeStr = node.positionConfig.toTimeString(resultObj.start.date);
resultObj.start.timeLocaleDateStr = node.positionConfig.toDateString(resultObj.start.date);
resultObj.end.timeLocaleTimeStr = node.positionConfig.toTimeString(resultObj.end.date);
resultObj.end.timeLocaleDateStr = node.positionConfig.toDateString(resultObj.end.date);
resultObj = getFormattedTimeSpanOut(node, operand1.value, operand2.value, config.result1TSFormat);
} else if (config.result1ValueType === 'operand1') {

@@ -350,2 +353,3 @@ resultObj = hlp.getFormattedDateOut(operand1.value, config.result1Format);

}
// node.debug('resultObj=' + util.inspect(resultObj, { colors: true, compact: 10, breakLength: Infinity }));
// to

@@ -408,2 +412,5 @@

break;
case 99: // otherwise
result = true;
break;
}

@@ -410,0 +417,0 @@ if (result) {

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

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

Sorry, the diff of this file is too big to display

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc