biddster / node-red-contrib-schedex

Scheduler for node-red which allows you to enter on/off times as 24hr clock (e.g. 01:10) or suncalc events (e.g. goldenHour). It also allows you to offset times and randomise the time within the offset.
23 stars 17 forks source link

Getting on and off times in local time #28

Closed drmibell closed 5 years ago

drmibell commented 6 years ago

Formatting times with toUTCString on an info request is a good idea, but it would be nice to have the option of getting local time or the unix time. The UTC string does not seem to be ingested by the moment library, so conversions are difficult.

elyobelyob commented 6 years ago

Is there a good reason to raise this on the moment project? Sounds reasonable to me.

On 27 December 2017 at 20:47, Michael I Bell notifications@github.com wrote:

Formatting times with toUTCString on an info request is a good idea, but it would be nice to have the option of getting local time or the unix time. The UTC string does not seem to be ingested by the moment library, so conversions are difficult.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/biddster/node-red-contrib-schedex/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AASMJlpNlt791lW7vVsuTtrX8a3ZCCUyks5tEqzZgaJpZM4RNzNc .

elyobelyob commented 6 years ago

Seems a discussion already had ... http://momentjs.com/docs/#/parsing/utc/

On 28 December 2017 at 06:24, Nick Boyle nick@elyob.com wrote:

Is there a good reason to raise this on the moment project? Sounds reasonable to me.

On 27 December 2017 at 20:47, Michael I Bell notifications@github.com wrote:

Formatting times with toUTCString on an info request is a good idea, but it would be nice to have the option of getting local time or the unix time. The UTC string does not seem to be ingested by the moment library, so conversions are difficult.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/biddster/node-red-contrib-schedex/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AASMJlpNlt791lW7vVsuTtrX8a3ZCCUyks5tEqzZgaJpZM4RNzNc .

drmibell commented 5 years ago

This issue is old but still open, so I want to add some confusion (and an example of why it still bothers me). I would like to use schedex to tell me the times of sunrise and sunset today. This flow injects msg.payload = {"suspended":false,"ontime":"sunrise","offtime":"sunset","lat":"39","lon":"-77"}.

sunrise-sunset

The status text reports local times, but the output from msg.payload = "info" uses GMT.

{"on":"Mon, 14 Jan 2019 12:27:00 GMT","off":"Mon, 14 Jan 2019 22:08:00 GMT","state":"off","ontopic":"","onpayload":"","offtopic":"","offpayload":""}

It seems to me that there should be a way to make the results consistent without having to do further processing on the payload.

biddster commented 5 years ago

Those dates should really have been ISO 8601 formatted anyway. Always felt like an oversight to me that they aren't.

But the horse has bolted now and folks are using this with the expectation that they'll get that format, so we might need another instruction like "info_local" or "infov2". Dunno, I'll mull it over.

drmibell commented 5 years ago

Thanks for looking into this. I share your preference for ISO 8601 format, in general and on principle, but here it seems odd that after entering local On and Off times, the info command returns them as ISO. I like the idea of an info_local command. My first thought was an option (checkbox) in the edit dialog requesting reports as local time, but it's not clear where to put it or how to word the label.

sam-wright commented 5 years ago

A checkbox that says "use localtime" or something equivalent would be greatly appreciated. I ran in circles for a long time wondering why events weren't firing before I realized the times were in GMT

sam-wright commented 5 years ago

ah please disregard my comment, I simply didn't pass localtime to my container. What I was talking about is not related to this discussion.

biddster commented 5 years ago

info_local command available in 1.6.0