Manage Complex Time Intervals
npx @raydeck/interval-manager [options]
Get the next scheduled time based on the provided interval
- --hour <
hour...
> Set hour on which this should fire - --minute <
minute...
> Set minute on which this should fire - --second <
second...
> Set second on which this should file - --timezone <
timezone
> Timezone for this (default:America/Chicago
) - --reference-date <
isoDate
> ISO-8601 representation of the reference (default:2021-04-05T21:51:49.410Z
) - --starting-date <
isoDate
> ISO-8601 representation of the date the interval had started (default:2021-04-05T21:51:49.410Z
) - --ending-date <
isoDate
> ISO-8601 representation of the date the interval had ended (default:2021-04-05T21:51:49.410Z
) - --dayOfMonth <
daynumber...
> Day of the month to run 1-31 (note that not all months have >28 days) - --dayOfWeek <
dayofweek...
> Day of the week to run, either a number from 0-6 one of sunday, monday, tuesday, wednesday, thursday, friday, saturday - --monthOfYear <
month...
> Month of the year to run in, either a number from 1-12 one of january, february, march, april, may, june, july, august, september, october, november, december - --orderInMonth <
weekNumber...
> Ordinal of the day of week within month to run, e.g. 2 and setting day of week to friday is second friday of the month - --dayOfYear <
dayNumber...
> Ordinal day of the year e.g. on ther 120th day of the year is 120 - --weekInterval <
weeks
> Number of weeks between each event - --dayInterval <
days
> Number of days between each event - --maxDates <
limit
> Number of dates to return (default:2
) - --verbose Use human-readable version of the date as output (default is ISO-8601)
@raydeck/interval-manager - v2.0.0
- APRIL
- AUGUST
- DAYINTERVALS
- DAYSOFWEEK
- DAYSOFYEAR
- DECEMBER
- FEBRUARY
- FRIDAY
- HOURS
- JANUARY
- JULY
- JUNE
- LASTDAY
- MARCH
- MAY
- MINUTES
- MONDAY
- MONTHSOFYEAR
- NOVEMBER
- OCTOBER
- ORDERINMONTH
- SATURDAY
- SECONDS
- SEPTEMBER
- SUNDAY
- THURSDAY
- TUESDAY
- WEDNESDAY
- WEEKINTERVALS
• Const
APRIL: 4= 4
Defined in: index.ts:433
• Const
AUGUST: 8= 8
Defined in: index.ts:437
• Const
DAYINTERVALS: number[]
Valid day intervals
Defined in: index.ts:512
• Const
DAYSOFWEEK: object
Name | Type |
---|---|
FRIDAY |
number |
MONDAY |
number |
SATURDAY |
number |
SUNDAY |
number |
THURSDAY |
number |
TUESDAY |
number |
WEDNESDAY |
number |
Defined in: index.ts:477
• Const
DAYSOFYEAR: number[]
Valid days of the year
Defined in: index.ts:508
• Const
DECEMBER: 12= 12
Defined in: index.ts:441
• Const
FEBRUARY: 2= 2
Defined in: index.ts:431
• Const
FRIDAY: 5= 5
Defined in: index.ts:428
• Const
HOURS: number[]
Valid
Defined in: index.ts:502
• Const
JANUARY: 1= 1
Defined in: index.ts:430
• Const
JULY: 7= 7
Defined in: index.ts:436
• Const
JUNE: 6= 6
Defined in: index.ts:435
• Const
LASTDAY: -1= -1
Defined in: index.ts:442
• Const
MARCH: 3= 3
Defined in: index.ts:432
• Const
MAY: 5= 5
Defined in: index.ts:434
• Const
MINUTES: number[]
Valid minutes
Defined in: index.ts:504
• Const
MONDAY: 1= 1
Defined in: index.ts:424
• Const
MONTHSOFYEAR: object
Name | Type |
---|---|
APRIL |
number |
AUGUST |
number |
DECEMBER |
number |
FEBRUARY |
number |
JANUARY |
number |
JULY |
number |
JUNE |
number |
MARCH |
number |
MAY |
number |
NOVEMBER |
number |
OCTOBER |
number |
SEPTEMBER |
number |
Defined in: index.ts:486
• Const
NOVEMBER: 11= 11
Defined in: index.ts:440
• Const
OCTOBER: 10= 10
Defined in: index.ts:439
• Const
ORDERINMONTH: number[]
Defined in: index.ts:500
• Const
SATURDAY: 6= 6
Defined in: index.ts:429
• Const
SECONDS: number[]
Valid seconds
Defined in: index.ts:506
• Const
SEPTEMBER: 9= 9
Defined in: index.ts:438
• Const
SUNDAY: 0= 0
Defined in: index.ts:423
• Const
THURSDAY: 4= 4
Defined in: index.ts:427
• Const
TUESDAY: 2= 2
Defined in: index.ts:425
• Const
WEDNESDAY: 3= 3
Defined in: index.ts:426
• Const
WEEKINTERVALS: number[]
Valid week intervals
Defined in: index.ts:516
▸ getNextDate(schedule
: IntervalSchedule, nowDate?
: Date): Date
Get the next date/time after the specified reference date
Name | Type | Description |
---|---|---|
schedule |
IntervalSchedule | IntervalSchedule that defines this interval pattern |
nowDate |
Date | Date the result must be after. Defaults to now |
Returns: Date
Date with the next time this schedule should fire
Defined in: index.ts:10
▸ isValidTimeZone(tz
: string): boolean
Determines whether a given string is a valid/known timezone identifier
Name | Type | Description |
---|---|---|
tz |
string | Source string (e.g. America/New_York ) |
Returns: boolean
True if the string is a valid time zone, false if not
Defined in: index.ts:412
▸ validateSchedule(schedule
: IntervalSchedule): void
Assert-style validator of whether a given IntervalSchedule contains valid values. Throws if not
Name | Type | Description |
---|---|---|
schedule |
IntervalSchedule | IntervalSchedule to test |
Returns: void
Defined in: index.ts:249
@raydeck/interval-manager - v2.0.0 / IntervalSchedule
Interface for defining a schedule for delayed intervals
- dayInterval
- daysOfMonth
- daysOfWeek
- daysOfYear
- endingOn
- hours
- minutes
- monthsOfYear
- orderInMonth
- seconds
- startingOn
- timezone
- weekInterval
• Optional
dayInterval: number
Days to wait between runs, starting from the startsOn date. This can run multiple times per day if hour
, minute
or second
are set with multiple values.Not compatible with weekInterval, monthsOfYear, daysOfYear
Defined in: index.ts:243
• Optional
daysOfMonth: number[]
Days of the month on which this should fire. Note that not all months have >28 days. Not compatible with dayInterval, weekInterval, daysOfYear
Defined in: index.ts:233
• Optional
daysOfWeek: number[]
Days of the week (specified as 0-6, where 0 is Sunday and 6 is Saturday). Not compatible with dayInterval, weekInterval, daysOfYear, daysOfMonth
Defined in: index.ts:235
• Optional
daysOfYear: number[]
Days of the year on which this should fire. E.g. to run on the 88th day of the year, specify [88]
. Note that not all months have >28 days. Not compatible with dayInterval, weekInterval, daysOfWeek
Defined in: index.ts:237
• Optional
endingOn: Date
Ending date for this schedule
Defined in: index.ts:219
• hours: number[]
Hours (in local time) on which this schedule should fire
Defined in: index.ts:223
• Optional
minutes: number[]
Minutes on which this should fire (e.g. [0, 30] for on the hour and half-hour) (default [0])
Defined in: index.ts:227
• Optional
monthsOfYear: number[]
Months of the year on which this should fire. Not compatible with dayInterval, weekInterval, daysOfYear
Defined in: index.ts:231
• Optional
orderInMonth: number[]
Order of the weekday to fire. For example, to run on the first friday, use {orderInMonth: [1], daysOfWeek:[5]}
. Note that using this requires specifying daysOfWeek
. Not compatibile with dayInterval, weekInterval, daysOfMonth, daysOfYear
Defined in: index.ts:241
• Optional
seconds: number[]
Seconds on which this should file (default [0])
Defined in: index.ts:229
• Optional
startingOn: Date
Starting date for this schedule (matters for dayInterval and weekInterval)
Defined in: index.ts:215
• timezone: string
Time zone to define local time rule (e.g. daylight savings)
Defined in: index.ts:211
• Optional
weekInterval: number
Weeks to wait between runs, starting from the startsOn date. This can run multiple times per day or on multiple weekdays based on daysOfWeek. Not compatible with dayInterval, monthsOfYear, daysOfYear
Defined in: index.ts:239