0

I have a UI where users select on which day of each month they want to receive an email. What happens if they select the 31st? How does Hangfire handle the days which have only 30 day or february?

Thank you!

AlesSvetina
  • 403
  • 3
  • 6
  • 19

2 Answers2

3

In case anyone comes back to this - this limitation was lifted in Hangfire 1.7 when they migrated to Chronos for recurring CRON expression support.

Gumzle
  • 847
  • 6
  • 16
1

According to this issue, Hangfire lacks the capability to schedule any job for the last day of the month.

Hangfire use NCrontab, that's not support for # or L

Your best bet (at the moment) is to:

  • Schedule multiple jobs manually (using calendar to figure out last day of the month or other methods to figure out days in a month)
  • Not use Hangfire (use something that is more capable in terms of cron type scheduling)

FluentScheduler does have support for LastDayOfTheMonth

Schedule(() => Console.WriteLine("This task will run at last day of every month."))
        .ToRunEvery(1)
        .Months()
        .OnTheLastDay();
Mrchief
  • 75,126
  • 20
  • 142
  • 189