BigTimer and getMoonTimes

I just spent ages debugging issue with theSunCalc module used in Node-Red-Contrib–BigTimer.

It turns out that the getMoonTimes module doesn’t seem to handle the alwaysUp and alwaysDown methods the way one might expected – these do not return FALSE  if not TRUE – they return undefined – that took some figuring out.

I started with try-catch but that failed also. Simply checking as follows did the trick:

if (typeof moons.rise===’undefined’)
moonrise=1440;
else
{
date2=moons.rise; moonrise = (date2.getHours() * 60) +
date2.getMinutes();
}              

if (typeof moons.set===’undefined’)
moonset=0;
else
{
date3=moons.set; moonset = (date3.getHours() * 60) +
date3.getMinutes();
}           

I’m pretty sure this is now fixed as of BigTimer 2.1.7

Thanks to Aidan Ruff for his help in this one.

6 thoughts on “BigTimer and getMoonTimes

  1. I tested this by setting the time to “disaster time” which is midnight 11 feb 0 hour! That’s when my NR stopped recording data to sqlite. var now= new Date(2019,1,11,0,0,0) temporarily.

Comments are closed.