Hyperlinkv0.8.0-beta.28

Cron

Cron.parseUnsafeconsteffect/Cron.ts:638
(cron: string, tz?: DateTime.TimeZone | string): Cron

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")
constructors
Source effect/Cron.ts:6381 lines
export const parseUnsafe = (cron: string, tz?: DateTime.TimeZone | string): Cron => Result.getOrThrow(parse(cron, tz))
Referenced by 1 symbols