[✅ Solution] Stop Automation during Night

Is there a way to stop an automation during the night? I tried something like this, but without success.

1 Like

@Roman

What an excellent question :slight_smile:

parseInt(date_fns.format(new Date(), 'HH'), 10) >= 6 && parseInt(date_fns.format(new Date(), 'HH'), 10) < 7

You will need to check the hours and remember these are UTC hours, hope that does what you want.

3 Likes

Wooohooo, thanks @Jason for the help. :pray:

2 Likes

How can i switch the UTC to CET/CEST (Winter/Summer)?

Use date_fns to convert time zone:

parseInt(date_fns.format(date_fns_tz.utcToZonedTime(new Date(),'Europe/Berlin'), 'HH'), 10) >= 11 && parseInt(date_fns.format(date_fns_tz.utcToZonedTime(new Date(),'Europe/Berlin'), 'HH'), 10) < 13

I think I have all my brackets in the correct place

3 Likes