Schedule Trigger for the last day of the month?

I’ve been trying to create a schedule that runs *only on the last day of each month*, but haven’t had any success so far. The workaround I found was to schedule it to run on the 28th through the 31st and then use an `if` condition to check if it’s actually the last day — but that means it unnecessarily runs on multiple days in months with 31 days, which isn’t ideal.

I also tried using `23 50 L * *` (hoping the `L` would handle the last day), but it didn’t work. Has anyone found a reliable way to do this?

Hello @Cobal

I think you can determine the last day of the month dynamically using JavaScript,
For example, you can get the number of days in the current month with this expression

{{ new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getDate() }}

which you can then use this value in the Trigger at Day of Monthfield:

Hi @Cobal

L isn’t supported in n8n’s cron (that’s Quartz syntax), so 23 50 L * * won’t ever work. The clean workaround is:

Schedule Trigger → run daily at the time you want (e.g. 0 23 * * *).
Then add a check:
IF node with an expression:

{{ $now.add(1, ‘day’).format(‘D’) === ‘1’ }}

or use a Function node:

const now = new Date(); const tomorrow = new Date(now); tomorrow.setDate(now.getDate() + 1); return tomorrow.getDate() === 1;

That way the workflow only continues on the actual last day of the month, works across all months and leap years.

Hope this helps and Kindly mark as the solution.

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.