I got a return "TypeError: time.getHours is not a function".
Why getHours is not a function while time is a date object?
var time = new Date().toLocaleTimeString();
flow.set("currenttime", time); //store at "currenttime"
//var hh = new Date(time).getHours();
//var mm = new Date(time).getMinutes();
var hh = time.getHours();
var mm = time.getMinutes();
msg.payload =
{"hour": hh,
"minute": mm,
};
return msg;