Node Red flow for specific days of the year

Is there a way to check if it’s a specific day of the year in Node Red?

I have a couple of flows that trigger when a sensor is acvitaved and sends me a notificiaition. I’d like to change the message of the notification if it’s a specific day of the year. Say 25 December. So far I can’t seem to find a way to check the day of the year in this way.

Bigtimer should be able to do what you want.

Could also just use a function node with a little javascript. The javascript Date.getMonth function is zero-based so January is 0 and December is 11.

let d = new Date();
if (d.getMonth() == 11 && d.getDate() == 25) {
	msg.payload = "Today is December 25th";
    return msg;

return null;

Thanks for the suggestions. I’d looked into BigTimer but I couldn’t seem to get the exclude / include special days to work. Do you have any suggestions? The documentation isn’t very detailed. The attached should only work on 31 October. However it’s currently showing as ‘on’ in Node-Red which can’t be right.


Looks like a function maybe the way to go if BigTimer can’t be used. Trying to avoid using JS as I’m not very familiar with it. @Kermit your code looks simple enough though.

I think you’ve entered the numbers incorrectly. It should look like this:

With you suggestion, is it possible to enter special date ranges? Ie. If I wanted the timer to work every day from 1-12 of December?

1 Like

You can use cronplus node. Best I know flexible solution with cron function.

I use the template node and Jinja templates for this purpose

[{"id":"23a7026a.523abe","type":"api-render-template","z":"66b702e7.2af0fc","name":"Date conditions","server":"9405c3fe.d0a6c","version":0,"template":"{{now().day in [1,15] and now().month|int in [1,4,7,10] }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":740,"y":1960,"wires":[["ea2b1fd8.f27a8"]]},{"id":"ea2b1fd8.f27a8","type":"switch","z":"66b702e7.2af0fc","name":"True?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":1960,"wires":[["c451cabc.026e48"]]},{"id":"62f8fda6.11a814","type":"inject","z":"66b702e7.2af0fc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":570,"y":1960,"wires":[["23a7026a.523abe"]]},{"id":"c451cabc.026e48","type":"debug","z":"66b702e7.2af0fc","name":"Do","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":1960,"wires":[]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Putting this here for anyone else looking for something like this. I found this in the NodeRed Pallet and its perfect! You can have a list of dates and date ranges and set a variable based on that all in the GUI.