Hi, I can't seem to work out why I always get a 'false' result when comparing 2 times in a nodered function with moment.js.
Taking the current time, and the sunset time and trying to test if it's before sunset.
appreciate any help
var sunset_time = global.get('homeassistant').homeAssistant.states["sun.sun"].attributes.next_setting;
var current_time = moment().local().format('HH:mm');
var sunset = moment.utc(sunset_time).local().format('HH:mm')
var test = moment(current_time).isBefore(moment(sunset))? "Yes" : "No"
var msg = {"payload": "current: "+current_time+" - sunset: "+sunset, "before sunset? ": test};
return msg;