Skip to main content
All schedule instances (returned by scheduler.command() and scheduler.call()) inherit from the BaseSchedule class, which provides methods for configuring frequency, timing, and behavior.

Configuration Methods

timezone()

Set the timezone for the schedule.
string
required
A valid timezone string (e.g., 'America/New_York', 'UTC', 'Asia/Tokyo')
Example

tag()

Assign a tag to the schedule for grouping and filtering.
string
required
The tag name to assign to this schedule
Example

immediate()

Run the schedule immediately when the worker starts, in addition to the scheduled times.
boolean
default:"true"
Whether to run immediately on start. Pass false to disable
Example

skip()

Disable the schedule without removing it.
boolean
default:"true"
Whether to skip this schedule. Pass false to re-enable
Example

withoutOverlapping()

Prevent the schedule from running if the previous execution is still in progress.
number
default:"3600000"
Lock expiration time in milliseconds (default: 1 hour). After this time, the lock is released even if the task is still running
Example

Lifecycle Methods

before()

Register a callback to run before the schedule executes.
() => Promise<void>
required
An async callback function to execute before the schedule runs
Example

after()

Register a callback to run after the schedule executes.
() => Promise<void>
required
An async callback function to execute after the schedule completes
Example

Frequency Methods - Every Second

everySecond()

Run the schedule every second.
Example

everySeconds()

Run the schedule every N seconds.
number
required
Number of seconds between executions (1-59)
Example

everyFiveSeconds()

Run the schedule every 5 seconds.

everyTenSeconds()

Run the schedule every 10 seconds.

everyFifteenSeconds()

Run the schedule every 15 seconds.

everyThirtySeconds()

Run the schedule every 30 seconds.

Frequency Methods - Every Minute

everyMinute()

Run the schedule every minute.
Example

everyMinutes()

Run the schedule every N minutes.
number
required
Number of minutes between executions
Example

everyTwoMinutes()

Run the schedule every 2 minutes.

everyThreeMinutes()

Run the schedule every 3 minutes.

everyFourMinutes()

Run the schedule every 4 minutes.

everyFiveMinutes()

Run the schedule every 5 minutes.

everyTenMinutes()

Run the schedule every 10 minutes.

everyFifteenMinutes()

Run the schedule every 15 minutes.

everyThirtyMinutes()

Run the schedule every 30 minutes.

Frequency Methods - Hourly

hourly()

Run the schedule every hour at the start of the hour.
Example

hourlyAt()

Run the schedule every hour at a specific minute offset.
string | number | number[]
required
The minute(s) of the hour to run (0-59). Can be a single value or an array for multiple times
Example

everyHours()

Run the schedule every N hours with an optional minute offset.
number
required
Number of hours between executions
string | number | number[]
default:"0"
The minute(s) of the hour to run
Example

everyOddHour()

Run the schedule every odd hour (1, 3, 5, etc.).
string | number | number[]
default:"0"
The minute(s) of the hour to run

everyTwoHours()

Run the schedule every 2 hours.

everyThreeHours()

Run the schedule every 3 hours.

everyFourHours()

Run the schedule every 4 hours.

everyFiveHours()

Run the schedule every 5 hours.

everySixHours()

Run the schedule every 6 hours.

Frequency Methods - Daily

daily()

Run the schedule once a day at midnight.
Example

dailyAt()

Run the schedule once a day at a specific time.
string
required
Time in 24-hour format (e.g., '14:30', '9:00')
Example

at()

Alias for dailyAt().

twiceDaily()

Run the schedule twice a day at specified hours.
number
default:"1"
First hour of the day (0-23)
number
default:"13"
Second hour of the day (0-23)
Example

twiceDailyAt()

Run the schedule twice a day at specified hours with a minute offset.
number
default:"1"
First hour of the day (0-23)
number
default:"13"
Second hour of the day (0-23)
number
default:"0"
Minute offset (0-59)
Example

Frequency Methods - Weekly

weekdays()

Run the schedule on weekdays (Monday through Friday).
Example

weekends()

Run the schedule on weekends (Saturday and Sunday).

mondays()

Run the schedule on Mondays.

tuesdays()

Run the schedule on Tuesdays.

wednesdays()

Run the schedule on Wednesdays.

thursdays()

Run the schedule on Thursdays.

fridays()

Run the schedule on Fridays.

saturdays()

Run the schedule on Saturdays.

sundays()

Run the schedule on Sundays.

days()

Run the schedule on specific days of the week.
number | number[]
required
Day(s) of the week (0 = Sunday, 6 = Saturday). Can be a single day or an array
Example

weekly()

Run the schedule once a week on Sunday at midnight.

weeklyOn()

Run the schedule once a week on a specific day and time.
number
default:"1"
Day of the week (0-7, where 0 and 7 are Sunday)
string
default:"'0:0'"
Time in 24-hour format
Example

Frequency Methods - Monthly

monthly()

Run the schedule once a month on the first day at midnight.
Example

monthlyOn()

Run the schedule once a month on a specific day and time.
number
default:"1"
Day of the month (1-31)
string
default:"'0:0'"
Time in 24-hour format
Example

twiceMonthly()

Run the schedule twice a month on specific days.
number
default:"1"
First day of the month (1-31)
number
default:"13"
Second day of the month (1-31)
string
default:"'0:0'"
Time in 24-hour format
Example

lastDayOfMonth()

Run the schedule on the last day of every month.
string
default:"'0:0'"
Time in 24-hour format
Example

quarterly()

Run the schedule once every quarter (January, April, July, October) on the first day at midnight.
Example

yearly()

Run the schedule once a year on January 1st at midnight.
Example

yearlyOn()

Run the schedule once a year on a specific date and time.
number
default:"1"
Month (1-12)
number
default:"1"
Day of the month (1-31)
string
default:"'0:0'"
Time in 24-hour format
Example

Advanced Methods

cron()

Define a custom cron expression for the schedule.
string
required
A cron expression with 6 fields: seconds minutes hours dayOfMonth month dayOfWeek
Example

getExpression()

Get the current cron expression for the schedule.
Returns: The current cron expression as a string Example

Day Constants

You can use day constants for better readability when scheduling:
Available constants:
  • SUNDAY = 0
  • MONDAY = 1
  • TUESDAY = 2
  • WEDNESDAY = 3
  • THURSDAY = 4
  • FRIDAY = 5
  • SATURDAY = 6