1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Tweak sunrise node to use UTC for all calculations...

This commit is contained in:
Dave C-J 2014-02-01 18:02:27 +00:00
parent 2dbd93d63d
commit 439ca32e09

View File

@ -29,13 +29,13 @@ function SunNode(n) {
this.tick = setInterval(function() { this.tick = setInterval(function() {
var now = new Date(); var now = new Date();
var hour = now.getHours(); var hour = now.getUTCHours();
var mins = now.getMinutes(); var mins = now.getUTCMinutes();
var times = SunCalc.getTimes(now, node.lat, node.lon); var times = SunCalc.getTimes(now, node.lat, node.lon);
var hour1 = times[node.start].getHours(); var hour1 = times[node.start].getUTCHours();
var mins1 = times[node.start].getMinutes(); var mins1 = times[node.start].getUTCMinutes();
var hour2 = times[node.end].getHours(); var hour2 = times[node.end].getUTCHours();
var mins2 = times[node.end].getMinutes(); var mins2 = times[node.end].getUTCMinutes();
var e1 = (hour*60+mins) - (hour1*60+mins1); var e1 = (hour*60+mins) - (hour1*60+mins1);
var e2 = (hour*60+mins) - (hour2*60+mins2); var e2 = (hour*60+mins) - (hour2*60+mins2);
var moon = parseInt(SunCalc.getMoonFraction(now)*100)/100; var moon = parseInt(SunCalc.getMoonFraction(now)*100)/100;