How can I make cron run on the last sunday of the month?

Hi,
How can I schedule a cron expression to run on the last sunday of the month?

I tried 45 18 * * 7L but it its unable to deploy the workflow. It works fine if I setup an source (example for Twitter) with the same cron expression as timer. My cron expression is valid here: https://crontab.cronhub.io/

I’ve ticked the “Allow Pipedream Support to access or edit this workflow” in the workflow.

(Sorry if I double posted, I changed my username on Pipedream and can’t seem to edit my first post)

Hi @msu ,

Unfortunately the L character is non-standard and I believe that’s the cause of the issue.

As a workaround, you can use the date-fns module to detect if the current date is the end of the month.

Thanks for sharing with support, that’s helpful, but we’ll also just need the URL of the workflow you’ve shared in order to find it and inspect.

1 Like

Thank you for your response.
Are there any plans on adding support for non-standard characters such as L and maybe W?

I will have a look at the date-fns module for sure, thanks!

Hi @msu,

To help track this request and help prioritize it, could you please request it here: Sign in to GitHub · GitHub

As for the date-fns work around, here’s a helpful function: endOfMonth

You can use it to determine the end of month date, if the current date is the same then continue to run the workflow.

Then you can use $end() to exit the workflow early on all days when the workflow isn’t running at the end of the month: End workflow early

It’s just a workaround, sorry we don’t have better support for extended crontabs, it would be very useful I agree.

1 Like

Thank you very much, @pierce. I will take a look at the workaround.

I’ve also requested this on github now: [FEATURE] Support non-standard character for cron expressions (L and W character) · Issue #2149 · PipedreamHQ/pipedream · GitHub

1 Like