Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/utils/cron-parser

lib/utils/cron-parser

Cron expression parser and scheduler utilities.

Provides parsing and evaluation of cron expressions for scheduled imports. Supports standard 5-field cron syntax with common patterns like daily, weekly, and monthly schedules. Used by the scheduled import system.

Interfaces

CronParts

Properties

minute

minute: string

hour

hour: string

dayOfMonth

dayOfMonth: string

month

month: string

dayOfWeek

dayOfWeek: string

Type Aliases

CronPattern

CronPattern = "every-minute" | "hourly" | "daily" | "weekly" | "monthly" | "complex"

Detect the pattern type from cron expression.

Functions

parseCronExpression()

parseCronExpression(cronExpression): CronParts

Parse a cron expression into its component parts.

Parameters

cronExpression

string

Returns

CronParts


validateCronParts()

validateCronParts(parts): void

Validate cron expression parts.

Parameters

parts

CronParts

Returns

void


detectCronPattern()

detectCronPattern(parts): CronPattern

Parameters

parts

CronParts

Returns

CronPattern


describeCronExpression()

describeCronExpression(cronExpression): string

Get human-readable description of cron expression.

Parameters

cronExpression

string

Returns

string


matchesCronField()

matchesCronField(field, value): boolean

Test if a cron field matches a specific value. Supports wildcards (*), steps (asterisk/N), ranges (A-B), and lists (A,B,C).

Parameters

field

string

value

number

Returns

boolean


matchesCronDate()

matchesCronDate(date, parts): boolean

Test if a date matches a cron expression’s parts.

Parameters

date

Date

parts

CronParts

Returns

boolean


calculateNextCronRun()

calculateNextCronRun(cronExpression, fromDate?): Date | null

Calculate the next time a cron expression matches after fromDate. Returns null if no match found within ~1 year.

Parameters

cronExpression

string

fromDate?

Date

Returns

Date | null

Last updated on