Job Scheduler/Background processor for recurring jobs within a date range
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE Added notes to about new CI Nuget packages Nov 20, 2017


Job Scheduler/Background processor for recurring jobs within a specified date range. Jobs are stored under a new recurring-daterange-job type, so they won't conflict with any jobs created with the existing recurring-job type.

Branch Build Status
Master Build status


Run the following from Package Manager Console:

  Install-Package Hangfire.RecurringDateRange

Also, during development/testing, I will frequently publish CI builds to Nuget as pre-release builds (so I can test/debug from my own projects that use Hangfire.RecurringDateRange.) If you want to use these un-tested builds at your own risk, run the following command:

  Install-Package -IncludePrerelease Hangfire.RecurringDateRange


To use, pass in a new instance of RecurringDateRangeJobScheduler() into UseHangfireServer:

  var backgroundServerJobOptions = new BackgroundJobServerOptions();
  appBuilder.UseHangfireServer(backgroundServerJobOptions, new RecurringDateRangeJobScheduler());

This library also uses NCrontab.Advanced for cron expression parsing. You can specify the format of your cron expressions via the cronStringFormat parameter:

  appBuilder.UseHangfireServer(backgroundServerJobOptions, new RecurringDateRangeJobScheduler(CronStringFormat.WithSecondsAndYears));

By default, RecurringDateRangeJobScheduler will use the time component of the start/end dates. If you want to ignore them, you can pass true/false as the 2nd parameter to the constructor (false is default):

  // Ingore the time component on start/end dates
  appBuilder.UseHangfireServer(backgroundServerJobOptions, new RecurringDateRangeJobScheduler(CronStringFormat.WithSecondsAndYears, true));

Then, instead of using the RecurringJob static methods, use the RecurringDateRangeJob static methods to create/remove jobs:

  // Runs a job every second between the 1st and 27th of January 2017
      () => Console.WriteLine("Awesomesauce!"), "* * * * *",
      startDate: DateTime.Parse("2017-01-01"),
      endDate: DateTime.Parse("2017-01-27")