Since I want day of year to trigger actions every other day and the current timestamp is the payload of the incoming flow message
provides the Boolean result required;)
beats my initial plod throughwhich required an additional odd/even evaluation step.
Code:
`msg.payload = Math.floor(msg.payload / 86400000) % 2;`beats my initial plod through
Code:
const aDay = 1000 * 60 * 60 * 24;var dt = new Date(msg.payload);var st = new Date();var DayOfYear = 0; st.setDate(1); st.setMonth(0); st.setHours(0); st.setMinutes(0); st.setSeconds(0); st.setMilliseconds(0); DayOfYear = Math.trunc((dt.getTime() - st.getTime())/ aDay) + 1; msg.payload = DayOfYear; return msg;Statistics: Posted by Lbox1 — Mon May 05, 2025 2:20 am