biddster / node-red-contrib-time-range-switch

A simple Node-RED node that routes messages depending on the time.
18 stars 6 forks source link

Invalid time range? #26

Closed DamianosS closed 4 years ago

DamianosS commented 4 years ago

Hi,

I'm running into the following issue:

Oct 24 16:29:25 ccu3-webui daemon.debug node-red[1014]: [within-time-switch:Time between 22:00 - 06:00?] getTimeProp data={ type: ^[[32m'entered'^[[39m, value: ^[[32m'22:00'^[[39m, offsetType: ^[[32m'none'^[[39m, offset: ^[[33m0^[[39m, multiplier: ^[[33m60000^[[39m } tzOffset=null
Oct 24 16:29:25 ccu3-webui daemon.debug node-red[1014]: [within-time-switch:Time between 22:00 - 06:00?] getTimeProp data={ type: ^[[32m'entered'^[[39m, value: ^[[32m'22:00'^[[39m, offsetType: ^[[32m'none'^[[39m, offset: ^[[33m0^[[39m, multiplier: ^[[33m60000^[[39m } tzOffset=null result={ value: ^[[35m2019-10-24T20:00:00.000Z^[[39m, error: ^[[1mnull^[[22m, fix: ^[[31mtrue^[[39m }
Oct 24 16:29:25 ccu3-webui daemon.debug node-red[1014]: [within-time-switch:Time between 22:00 - 06:00?] getTimeProp data={ type: ^[[32m'entered'^[[39m, value: ^[[32m'06:00'^[[39m, offsetType: ^[[32m'none'^[[39m, offset: ^[[33m0^[[39m, multiplier: ^[[33m60000^[[39m } tzOffset=null
Oct 24 16:29:25 ccu3-webui daemon.debug node-red[1014]: [within-time-switch:Time between 22:00 - 06:00?] getTimeProp data={ type: ^[[32m'entered'^[[39m, value: ^[[32m'06:00'^[[39m, offsetType: ^[[32m'none'^[[39m, offset: ^[[33m0^[[39m, multiplier: ^[[33m60000^[[39m } tzOffset=null result={ value: ^[[35m2019-10-24T04:00:00.000Z^[[39m, error: ^[[1mnull^[[22m, fix: ^[[31mtrue^[[39m }
Oct 24 16:29:25 ccu3-webui daemon.debug node-red[1014]: [within-time-switch:Time between 22:00 - 06:00?] out of time - send msg to second output 10/24/2019 4:29:25 PM

Is the time range across midnight a problem?

Thanks!

biddster commented 4 years ago

I don't think it's an issue. But I'll drop another unit test in and see.

DamianosS commented 4 years ago

Any news? The error still occurs.

Thanks!

biddster commented 4 years ago

I've bashed up a test and all appears to be working as expected:

Wed Oct 23 2019 19:29:25 GMT+0100, output 2
Wed Oct 23 2019 20:29:25 GMT+0100, output 2
Wed Oct 23 2019 21:29:25 GMT+0100, output 2
Wed Oct 23 2019 22:29:25 GMT+0100, output 1
Wed Oct 23 2019 23:29:25 GMT+0100, output 1
Thu Oct 24 2019 00:29:25 GMT+0100, output 1
Thu Oct 24 2019 01:29:25 GMT+0100, output 1
Thu Oct 24 2019 02:29:25 GMT+0100, output 1
Thu Oct 24 2019 03:29:25 GMT+0100, output 1
Thu Oct 24 2019 04:29:25 GMT+0100, output 1
Thu Oct 24 2019 05:29:25 GMT+0100, output 1
Thu Oct 24 2019 06:29:25 GMT+0100, output 2
Thu Oct 24 2019 07:29:25 GMT+0100, output 2
Thu Oct 24 2019 08:29:25 GMT+0100, output 2
Thu Oct 24 2019 09:29:25 GMT+0100, output 2
Thu Oct 24 2019 10:29:25 GMT+0100, output 2
Thu Oct 24 2019 11:29:25 GMT+0100, output 2
Thu Oct 24 2019 12:29:25 GMT+0100, output 2
Thu Oct 24 2019 13:29:25 GMT+0100, output 2
Thu Oct 24 2019 14:29:25 GMT+0100, output 2
Thu Oct 24 2019 15:29:25 GMT+0100, output 2
Thu Oct 24 2019 16:29:25 GMT+0100, output 2
Thu Oct 24 2019 17:29:25 GMT+0100, output 2
Thu Oct 24 2019 18:29:25 GMT+0100, output 2

Msg goes to output 1 between 10pm and 6am. Any other time goes to output 2.

DamianosS commented 4 years ago

Thanks, @biddster for checking. For whatever reason, the error didn't occur for two days. I will observe, and if it doesn't come up anymore I'll close the issue.

biddster commented 4 years ago

Cool. Glad it's working for you now.