node-red-contrib-sun-position
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -761,4 +761,8 @@ /******************************************** | ||
function getFormattedDateOut(date, format, dayNames, monthNames, dayDiffNames) { | ||
console.debug('getFormattedDateOut date=' + date + ' --> format=' + format + ' [' + dayNames + '] - [' + monthNames + '] [' + dayDiffNames + ']'); // eslint-disable-line | ||
// console.debug('getFormattedDateOut date=' + date + ' --> format=' + format + ' [' + dayNames + '] - [' + monthNames + '] [' + dayDiffNames + ']'); // eslint-disable-line | ||
format = format || 0; | ||
if (!(date instanceof Date)) { | ||
date = Date(date); | ||
} | ||
if (isNaN(format)) { | ||
@@ -772,3 +776,3 @@ return _formatDate(date, String(format), false, dayNames, monthNames, dayDiffNames); | ||
case 1: // timeformat_ECMA262 - date as string ECMA-262 | ||
return date; | ||
return String(date); | ||
case 2: // timeformat_local - 26.12.2018, 23:40:45 - timeformat_G - 6/15/2009 1:45:30 PM | ||
@@ -813,2 +817,3 @@ return date.toLocaleString(); | ||
ts: date.getTime(), | ||
dateStr: String(date), | ||
timeUTCStr: date.toUTCString(), | ||
@@ -819,3 +824,4 @@ timeISOStr: date.toISOString(), | ||
delay, | ||
delaySec: Math.round(delay / 1000) | ||
delaySec: Math.round(delay / 1000), | ||
lc: now.getTime() | ||
}; | ||
@@ -822,0 +828,0 @@ } |
@@ -135,3 +135,3 @@ /******************************************** | ||
const times = sunCalc.getMoonTimes(date, node.latitude, node.longitude, true); | ||
result.value = hlp.addOffset(new Date(new Date(times[value])), offset, multiplier); | ||
result.value = hlp.addOffset(new Date(times[value]), offset, multiplier); | ||
// node.debug('Moon Times for ' + date + ' =' + util.inspect(times)); | ||
@@ -146,3 +146,3 @@ } | ||
const times = sunCalc.getMoonTimes(date, node.latitude, node.longitude, true); | ||
result.value = hlp.addOffset(new Date(new Date(times[value])), offset, multiplier); | ||
result.value = hlp.addOffset(new Date(times[value]), offset, multiplier); | ||
// node.debug('Moon Times for ' + date + ' =' + util.inspect(times)); | ||
@@ -213,2 +213,4 @@ } else if (dayx < 0) { | ||
return msg.ts; | ||
} else if (vType === 'msgLc') { | ||
return msg.lc; | ||
} else if (vType === 'msgValue') { | ||
@@ -255,3 +257,3 @@ return msg.value; | ||
if (vType === null || vType === 'none' || vType === '') { | ||
return (new Date()); | ||
return new Date(); | ||
} else if (vType === 'date') { | ||
@@ -290,2 +292,4 @@ return new Date(); | ||
result = msg.ts; | ||
} else if (vType === 'msgLc') { | ||
return msg.lc; | ||
} else if (vType === 'msgValue') { | ||
@@ -324,3 +328,3 @@ result = msg.value; | ||
} else if (vType === 'date') { | ||
result.value = (new Date()); | ||
result.value = new Date(); | ||
result.fix = true; | ||
@@ -373,3 +377,3 @@ } else if (vType === 'dateSpecific') { | ||
} | ||
result.value = (new Date()); | ||
result.value = new Date(); | ||
} | ||
@@ -376,0 +380,0 @@ |
@@ -153,5 +153,20 @@ /************************************************************************/ | ||
}, | ||
MsgDelay: { | ||
value: 'msgDelay', | ||
label: 'msg.delay', | ||
hasValue: false | ||
}, | ||
MsgOnTime: { | ||
value: 'msgOnTime', | ||
label: 'msg.onTime', | ||
hasValue: false | ||
}, | ||
MsgRampTime: { | ||
value: 'msgRampTime', | ||
label: 'msg.rampTime', | ||
hasValue: false | ||
}, | ||
TimeEntered: { | ||
value: 'entered', | ||
label: 'time (current day)', | ||
label: 'time (next)', | ||
icon: 'icons/node-red-contrib-sun-position/inputTypeTime.png', | ||
@@ -170,4 +185,4 @@ hasValue: true, | ||
value: 'TimePredefined', | ||
label: 'time (current day)', | ||
options: ['midnight (current day)', 'noon (current day)'] | ||
label: 'fixed times', | ||
options: ['next midnight', 'next noon'] | ||
}, | ||
@@ -174,0 +189,0 @@ DayOfMonth: { |
@@ -57,2 +57,4 @@ /******************************************** | ||
msg.ts = resultObj; | ||
} else if (config.result1Type === 'msgLc') { | ||
msg.lc = resultObj; | ||
} else if (config.result1Type === 'msgValue') { | ||
@@ -59,0 +61,0 @@ msg.value = resultObj; |
@@ -27,5 +27,5 @@ /******************************************** | ||
function tsSetAddProp(node, msg, type, name, valueType, value, format, offset, offsetType, multiplier, days) { | ||
if (type !== 'none' && name) { | ||
// node.debug(`tsSetAddProp ${msg}, ${type}, ${name}, ${valueType}, ${value}, ${format}, ${offset}, ${offsetType}, ${multiplier}, ${days}`); | ||
if (type !== 'none') { | ||
const res = node.positionConfig.getOutDataProp(node, msg, valueType, value, format, offset, offsetType, multiplier, days); | ||
// node.debug('getOutDataProp result is:' + util.inspect(res)); | ||
if (res === null || (typeof res === 'undefined')) { | ||
@@ -39,5 +39,13 @@ throw new Error('could not evaluate ' + valueType + '.' + value); | ||
msg.ts = res; | ||
} else if (type === 'msgLc') { | ||
msg.lc = res; | ||
} else if (type === 'msgValue') { | ||
msg.value = res; | ||
} else if (type === 'msg' || type === 'msgProperty') { | ||
} else if (type === 'msgDelay') { | ||
msg.delay = res; | ||
} else if (type === 'msgOnTime') { | ||
msg.onTime = res; | ||
} else if (type === 'msgRampTime') { | ||
msg.rampTime = res; | ||
} else if (type === 'msg') { | ||
RED.util.setMessageProperty(msg, name, res); | ||
@@ -44,0 +52,0 @@ } else if ((type === 'flow' || type === 'global')) { |
@@ -288,5 +288,7 @@ /******************************************** | ||
msg.ts = resultObj; | ||
} else if (config.result1Type === 'msgLc') { | ||
msg.lc = resultObj; | ||
} else if (config.result1Type === 'msgValue') { | ||
msg.value = resultObj; | ||
} else if (config.result1Type === 'msg' || config.result1Type === 'msgProperty') { | ||
} else if (config.result1Type === 'msg') { | ||
RED.util.setMessageProperty(msg, config.result1, resultObj); | ||
@@ -293,0 +295,0 @@ } else if (config.result1Type === 'flow' || config.result1Type === 'global') { |
{ | ||
"name": "node-red-contrib-sun-position", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"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
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
1229376
5722