-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] - Support scheduling months based count of days since last day of the month (-2, -3, etc.) #523
Comments
Hi @SrijaSingu The functionality you're describing doesn't currently exist in gocron. I'm going to change this issue into a feature request tag. |
how is the expected interface? now in the method being -1 the last day, -2 the penultimate day of the month, etc? |
what about the
|
I think this will still not support all the months correctly. For example if I say -2 for 31 days months it will be 29, For 30 days months it will be 28 and for February it will be 27 or 26. |
I guess that depends on expected behavior. The design here is to support X days prior to the last day of the month. If you wanted to run on the 29th of the month, then you could, for all months except Feb (except leap years). Handling which day it should run each month is interesting and all depends on what each user wants. If you wanted exact control, you could schedule several copies of the job. For example, a job that runs every 12 months on Feb 28th, and then jobs that run April, June, September, and November on the 29th, and then on the 30th of the other months. |
Describe the bug
Go cron monthly schedule is not scheduling job on the day specified in the month if the day exists for the month.This behaviour is seen only in last days of the months i.e, 29th, 30th , 31st.It is throwing validation error if any day is choosen among them.
In the library, it is mentioned that -1 is special value that can be used to create schedule on last day for all the months. But if user wants to schedule a job on every 29th of the month, he cannot even though the day exists for the month.
To Reproduce
Steps to reproduce the behavior:
Version
v1.30.1
Actual behavior
Validation Error thrown - "only days 1 through 28 are allowed for monthly schedules"
Expected behavior
It should schedule job on 29th day for the months if the day exists.
Expected to schedule for all months except February.For February, it can schedule job on last day of the month since day does not exists (considering it's not leap year).
The text was updated successfully, but these errors were encountered: