There's no single cron notation to run a task every last day of the month. You can run the task at the first day of the month at midnight or make use of npm module like bree to run the task at the last day of the month or have mutiple cron jobs for a single task.
But if you want to stick to cron, a simple solution is to run the tasks from 28 - 31 every month but make use of any robust date framework (that what date tomorrow is) to determine if any of the date is the last date. For instance
cron.schedule("0 0 28-31 * *",()=>{if(date.getTomorrow()==="1"){// that's the last daydoSomeTasks()}})
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you very much!
What would be the simplest cron job notation to run every last day of every month including a leap-year?
There's no single cron notation to run a task every last day of the month. You can run the task at the first day of the month at midnight or make use of npm module like bree to run the task at the last day of the month or have mutiple cron jobs for a single task.
But if you want to stick to cron, a simple solution is to run the tasks from 28 - 31 every month but make use of any robust date framework (that what date tomorrow is) to determine if any of the date is the last date. For instance