# Cron-plus not providing correct sunrise/set times in payload but correct time under the node

**URL:** <https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874>\
**Category:** General\
**Created:** [12 December 2024 11:49 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874 "2024-12-12T11:49:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 December 2024 11:49 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/1 "2024-12-12T11:49:39Z")

</div>

Node-RED v 4.0.5 - cron-plus v2.1.0  
MacOS Sequoia v15.1.1

I'm trying to get sunrise and sunset times using latitude/longitude settings in the settings location. While the sunrise time is correct in the display under the cron-plus node, it does not show the same date/time in the payload:

 ![Screenshot 2024-12-12 at 6.28.17 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/859cd62f1ddca340296591c9d4b2ade38d51eb14.png)

 ![Screenshot 2024-12-12 at 6.40.24 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/3/83b2fe99e68e368580274c2a8f33b13a4c657aa2.png)

Any thoughts on this?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 December 2024 12:01 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/2 "2024-12-12T12:01:37Z")

</div>

The difference is because CRON+ is reporting time in EST but the debug node is showing the time in UTC (AKA GMT, AKA "Zulu" - hence the "Z" at the end of the output).

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 December 2024 12:20 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/3 "2024-12-12T12:20:33Z")

</div>

I would think that cron+ should be outputting the time based on the lat/lon so it would agree what it is displaying under the node. A Coordinated Universal Time is 5 hours ahead of Boston, MA but the node output only shows a two hour difference.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 December 2024 12:53 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/4 "2024-12-12T12:53:36Z")

</div>

> [@zenofmud](#):
>
> I would think that cron+ should be outputting the time based on the lat/lon so it would agree what it is displaying under the node

CRON+ outputs a date object. It is node-red that is showing the ZULU time.

Proof:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc4be663ab767b0788e05e4f3a98760b02e11af9.png)

```auto
[{"id":"75a6bc5e5f8cad7f","type":"cronplus","z":"854cb259ba408a9a","name":"","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"42.357589794193025 -71.07847546460107","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule1","topic":"sunrise+sunset","payloadType":"default","payload":"","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise,sunset"}],"x":1170,"y":300,"wires":[["e3566f614224aac2","60ce631317d0eea4"]]},{"id":"e3566f614224aac2","type":"function","z":"854cb259ba408a9a","name":"proof","func":"const info = {}\nconst now = new Date()\ninfo.time0 = msg.payload.status.solarTimes[0].time\ninfo.time0local = info.time0.toLocaleString()\ninfo.time0Type = typeof info.time0\ninfo.time0name = msg.payload.status.solarTimes[0].event\n\ninfo.time1 = msg.payload.status.solarTimes[1].time\ninfo.time1local = info.time1.toLocaleString()\ninfo.time1Type = typeof info.time1\ninfo.time1name = msg.payload.status.solarTimes[1].event\n\nnode.warn(info);\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":260,"wires":[[]]},{"id":"60ce631317d0eea4","type":"debug","z":"854cb259ba408a9a","name":"solarEvent","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.status.solarTimes","targetType":"msg","statusVal":"","statusType":"auto","x":1350,"y":300,"wires":[]}]

```

* * *

In future, to save me recreating the node, please export the CRON node. Thanks.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 December 2024 13:27 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/5 "2024-12-12T13:27:29Z")

</div>

> [@zenofmud](#):
>
> A Coordinated Universal Time is 5 hours ahead of Boston, MA but the node output only shows a two hour difference.

Your pic correctly shows the node status EST as 5 hours behind the debug's UTC?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 March 2025 13:28 UTC](https://discourse.nodered.org/t/cron-plus-not-providing-correct-sunrise-set-times-in-payload-but-correct-time-under-the-node/93874/6 "2025-03-12T13:28:17Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
