parseCronExpression (shared/automation-schedule-parsing.ts)

orca · src/shared/automation-schedule-parsing.ts · typescript · MIT
automation, tag:knn-classified

Parses cron and rrule schedules into structured objects for automation.

// Source: https://github.com/stablyai/orca | License: MIT | Copyright 2026 Lovecast Inc
// Provided via justclaw.it.com; keep this notice with the code.
import type { AutomationSchedulePreset } from './automations-types'
import { cronHasPossibleOccurrence } from './automation-cron-occurrence'

import { isClipboardTextByteLengthOverLimit } from './clipboard-text'
import {
  DAY_NAMES,
  MONTH_NAMES,
  isCronDayFieldRestricted,
  parseCronField,
  type CronParseOptions
} from './automation-cron-field-parsing'

export const AUTOMATION_CRON_EXPRESSION_MAX_BYTES = 2 * 1024
export type ParsedRrule = {
  kind: 'rrule'
  freq: 'HOURLY' | 'DAILY' | 'WEEKLY'
  byDay: string[]
  byHour: number
  byMinute: number
}

export type ParsedCron = {
  kind: 'cron'
  minutes: Set<number>
  hours: Set<number>

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key