🧠 [Tip] Schedule scenarios to run on the last day of the month

Hey Makers :wave:


Ever wondered how to set up your scenarios so that they run on the very last day of the month?
:make: Check out this step-by-step guide on how to do exactly that :make:



The setup consists of 2 parts:

:spiral_calendar: scheduled runs on 28,29,30 and 31 of each month

:wrench: a filter that checks if it is actually the last day of the given month


1. Scheduling:

Set the schedule to 28,29,30 and 31 of every month.



2. Filter with functions after trigger module



Function for copypasta: {{formatDate(addDays(addMonths(setDate(now; 1); 1); -1); β€œDD”)}}

How it works:

  1. setDate function sets the date to the 1st day of the current month
  2. addMonths function adds 1 month, taking us to 1st day of the next month
  3. addDays -1 subtracts 1 day, taking us to the last day of the current month
  4. formatDate with DD token gives us the number of the last day of the current month
  5. the result of the 4 functions above is then checked against the current date {{formatDate(now; β€œDD”)}}
  6. scenario runs on 28,29,30 and 31 and checks if it is the last day of the month, if yes, it passes the filter :cyclone: woosh!



PS: A big shout-out to our support team for sharing this brain-teaser and to @Matous_Vrba for breaking it down for us :purple_heart:

15 Likes

I’ve posted a better way of doing this here:

πŸ“… How to schedule scenario for the last day next/every month

 
Saves up to additional three operations a month, and you don’t need a filter, or use of the formatDate function β€” it works like magic!