devRoemer / node-red-contrib-time-switch

A node that switches on and off depending on the current time
MIT License
3 stars 0 forks source link

The same Node but with Date #22

Open Danit2 opened 1 year ago

Danit2 commented 1 year ago

Is your feature request related to a problem? Please describe. Your Node is so simple and easy to use. i love it. But i can not found any one that do the same with date. I search a lot to find a node that switch with date. Now i do it with a template node and a switch node.

Describe the solution you'd like The same as the time node with date.

devRoemer commented 1 year ago

Thanks for your feedback. That's an interesting use case that could be implemented with an additional node for dates.

Danit2 commented 1 year ago

Thanks for your answer. yes i think it would be great when this would be a new node. it would also be cool when you can use some special days like "first advent", "eastern", and more. and also an offset of days. example: first advent + 1 day.

I use this at the moment for my christmaslight and others things that only run in the summertime.

at the moment i have a template node and a switch node to do that.

in the template node i have this:

{% set first_advent = now().replace(day=25, month=12) - timedelta(days = 21 + now().replace(day=25, month=12).isoweekday() ) %}
{{ first_advent <= now() <= now().replace(day=31, month=12) or now() <= now().replace(day=8, month=1) }}

Thanks for your work.