node-red-contrib-sun-position
Advanced tools
Comparing version 0.5.2 to 0.5.3
# node-red-contrib-sun-position | ||
#### 0.5.3: BugFix | ||
- general | ||
- fix for #68 | ||
#### 0.5.2: BugFix | ||
@@ -4,0 +9,0 @@ |
@@ -263,6 +263,23 @@ /******************************************** | ||
}); | ||
const nowTs = now.getTime(); | ||
const nowTs = now.getTime() + 300; // offset to get really next | ||
let last = sortable[0]; | ||
if (last.ts > nowTs) { | ||
return [result['nadir'], last]; | ||
if (last.ts >= nowTs) { | ||
return { | ||
next : { | ||
value : new Date(result['nadir'].value), | ||
name : result['nadir'].name, | ||
index : result['nadir'].index, | ||
pos : result['nadir'].pos, | ||
valid : result['nadir'].valid, | ||
elevation : result['nadir'].elevation | ||
}, | ||
last : { | ||
value : new Date(last.value), | ||
name : last.name, | ||
index : last.index, | ||
pos : last.pos, | ||
valid : last.valid, | ||
elevation : last.elevation | ||
} | ||
}; | ||
} | ||
@@ -273,3 +290,20 @@ for (let index = 1; index < sortable.length; index++) { | ||
if (element.ts > nowTs) { | ||
return [last, element]; | ||
return { | ||
next : { | ||
value : new Date(element.value), | ||
name : element.name, | ||
index : element.index, | ||
pos : element.pos, | ||
valid : element.valid, | ||
elevation : element.elevation | ||
}, | ||
last : { | ||
value : new Date(last.value), | ||
name : last.name, | ||
index : last.index, | ||
pos : last.pos, | ||
valid : last.valid, | ||
elevation : last.elevation | ||
} | ||
}; | ||
} | ||
@@ -279,3 +313,20 @@ last = element; | ||
} | ||
return [last, sortable[0]]; | ||
return { | ||
next : { | ||
value : new Date(sortable[0].value), | ||
name : sortable[0].name, | ||
index : sortable[0].index, | ||
pos : sortable[0].pos, | ||
valid : sortable[0].valid, | ||
elevation : sortable[0].elevation | ||
}, | ||
last : { | ||
value : new Date(last.value), | ||
name : last.name, | ||
index : last.index, | ||
pos : last.pos, | ||
valid : last.valid, | ||
elevation : last.elevation | ||
} | ||
}; | ||
} | ||
@@ -475,3 +526,13 @@ /*******************************************************************************************************/ | ||
} else if (data.type === 'pdsTimeNow') { | ||
return Object.assign({}, this.getSunTimePrevNext(now)); | ||
result = Object.assign({}, this.getSunTimePrevNext(now)); | ||
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError); | ||
result.next.value = hlp.normalizeDate(result.next.value, offsetX, data.multiplier, data.next, data.days); | ||
if (data.format > 0) { | ||
return hlp.getFormattedDateOut(result.next, data.format, (this.tzOffset === 0), this.tzOffset); | ||
} | ||
if (this.tzOffset) { | ||
result.prev.value = hlp.convertDateTimeZone(result.prev.value, this.tzOffset).getTime(); | ||
result.next.value = hlp.convertDateTimeZone(result.next.value, this.tzOffset).getTime(); | ||
} | ||
return result; | ||
} else if (data.type === 'entered' || data.type === 'dateEntered') { | ||
@@ -588,3 +649,6 @@ result = hlp.getDateOfText(String(data.value), (this.tzOffset === 0), this.tzOffset); | ||
} else if (data.type === 'pdsTimeNow') { | ||
return this.getSunTimePrevNext(now)[1]; | ||
result = this.getSunTimePrevNext(now).next; | ||
result.fix = true; | ||
const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError); | ||
result.value = hlp.addOffset(result.value, offsetX, data.multiplier, data.next); // , data.days); | ||
} else if (data.type === 'str') { | ||
@@ -591,0 +655,0 @@ result.fix = true; |
{ | ||
"name": "node-red-contrib-sun-position", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "NodeRED nodes to get sun and moon position", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
1202445
8940