Converting Unix Time thru Moment

I am grabbing the sunrise (payload.daily.data[0].sunriseTime) and sunset (payload.daily.data[0].sunsetTime) times from the DarkSky node. As its Unix time, I multiply it by 1000, then convert it using two Moment nodes, which outputs each one as a string (and the correct time in the correct format)
So a couple of scenarios.

  1. If I take the individual outputs and enter into the template, it overwrites the other one. Makes sense, I think.
  2. If I put them thru the join node, I get an "undefined".

I can display them in the dashboard individually in a template (which will be cumbersome), so it seems I must be missing something. Any ideas?

Make sure each one has a different topic, then configure the join node in key/value pair mode.
See this page in the cookbook.

Thanks, I do have this flow that I have been using as my guide and have two separate topics.

Where I made my mistake, is that I was naming the outputs specifically vs generically. (e.g. msg.payload.alerttime) vs msg.payload. So when the join received the two outputs after the Moment magic, it was receiving two unique msg.playloads. Renamed the Moment outputs to msg.playload and problem solved.

SO the real problem is was overthinking what I needed to do vs letting the topics do all the heavy lifting...

1 Like