effect-io-ai

Package: effect
Module: Cron

Cron.parseUnsafe

Parses a cron expression into a Cron instance, throwing on failure.

When to use

Use when you expect the input to be valid and want to avoid handling the Result type.

Example (Parsing cron expressions unsafely)

import { Cron } from "effect"

// At 04:00 on every day-of-month from 8 through 14
const cron = Cron.parseUnsafe("0 0 4 8-14 * *")

// With timezone
const cronWithTz = Cron.parseUnsafe("0 0 9 * * *", "America/New_York")

// This would throw an error
// const invalid = Cron.parseUnsafe("invalid expression")

Signature

declare const parseUnsafe: (cron: string, tz?: DateTime.TimeZone | string) => Cron

Source

Since v4.0.0