//const shiftstart = msg.payload.shift_start.timestamp;
//const clockin = msg.payload.clockin_time.timestamp;
//const timeDifference = shiftstart - clockin;
//const timeDifference2 = clockin - shiftstart;
var breakd = msg.payload.duration
breakd = breakd.replace('m',"");
breakd = Number(breakd);
msg.payload.woo2 = breakd;
// if ((timeDifference/60).toFixed(0) >= 3){
// msg.payload = msg.payload.name +" was " + (timeDifference/60).toFixed(0) + " minutes early today";
// } else if ((timeDifference/60).toFixed(0) < 3){
// msg.payload = msg.payload.name +" was " + (timeDifference2/60).toFixed(0) + " minutes late today";
// }
if (breakd < 25) { msg.payload.woo = "over 25"}
else {msg.payload.woo = "under 25"}
return msg;
If I remove the comment slashes, msg.payload.woo2
goes 'undefined' - if I keep them in, I get a number.
Confusing what about the commented out code is somehow overwriting msg.payload.woo2
Anyone know?! Thanks