schedule icon indicating copy to clipboard operation
schedule copied to clipboard

Add the functionality to run jobs at monthly or yearly intervals on specific dates

Open masa-08 opened this issue 2 years ago • 3 comments

resolve #487

This PR will implement the feature discussed in the above issue.

To summarize this issue

  • The functionality to schedule on a monthly or yearly unit is needed.
  • Considering the job persistence that @gabrielcipriano points out, we should not simply add the functionality to schedule on a monthly or yearly unit.
  • In light of these considerations, it is desirable to design the system to allow scheduling on a monthly or yearly unit as long as the specific dates are specified, which is the idea of @ttamg.

Therefore, I have implemented the feature that allows scheduling on a monthly or yearly unit by specifying a specific date.

This feature can be used as follows

# Run jobs on the 5th of each month.
schedule.every().date("05").do(job)
# Run jobs at 9:00 on Dec 5th every two years.
schedule.every(2).date("12/05").at("09:00").do(job)

Your review and comments would be greatly appreciated.

masa-08 avatar Feb 16 '23 09:02 masa-08

Any progress on merging this? I also need this functionality.

c0d3rman avatar Oct 01 '23 06:10 c0d3rman

I agree monthly and yearly would be great additions, but I would like to make an additional suggestion for the monthly, namely the first and last of the month with offsets: .firstof() would then be the 1st of the month .lastof() would be the last of the month.

Offsets could then be done as follows: .firstof(1) would then be the 2nd of the month .lastoff(1) would then be the day before the last day of the month.

detheavn avatar Nov 16 '23 10:11 detheavn

bump, PR becoming stale?

Benjythebee avatar Jun 03 '24 23:06 Benjythebee