You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happens if a task is scheduled for the last day of one month and that day doesn't exist in the next month?
I'm trying to run tasks every month regardless of the number of days in the month. So if I schedule a task to run every day: 31 in January then this task won't run in February.
How do you handle this?
The text was updated successfully, but these errors were encountered:
Good question. I don't think the package supports this use case. If you specify day: 31 then I think in months that have fewer days than 31 the function will get executed in the early days of the next month (30 days -> execute on 1st, 28 days -> execute on 3rd). I haven't validated this, but I'm using the setDate of Date objects to set the day, and that's the way that function handles cases like that.
Example:
> x = new Date()
Sun Sep 21 2014 17:33:11 GMT-0700 (PDT)
> x.setDate(32)
1412296391273
> x
Thu Oct 02 2014 17:33:11 GMT-0700 (PDT)
It occurred to me that setDate(-1) will give you the last day of the previous month. This might be all you need. Have you tried entering a -1 for the month entry of the cron schedule? That might work out of the box.
What happens if a task is scheduled for the last day of one month and that day doesn't exist in the next month?
I'm trying to run tasks every month regardless of the number of days in the month. So if I schedule a task to run every
day: 31
in January then this task won't run in February.How do you handle this?
The text was updated successfully, but these errors were encountered: