effect-io-ai

Package: effect
Module: Cron

Cron.equals

Checks whether two Cron instances have equal timezone values, field restrictions, and day-matching modes.

When to use

Use to directly compare two cron schedules, including their timezones and day-matching modes.

Details

The comparison checks the optional timezone, the and day-matching mode, seconds, minutes, hours, days, months, and weekdays.

Example (Checking schedule equality)

import { Cron } from "effect"

const cron1 = Cron.make({
  minutes: [0],
  hours: [9],
  days: [1, 15],
  months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  weekdays: [1, 2, 3, 4, 5]
})

const cron2 = Cron.make({
  minutes: [0],
  hours: [9],
  days: [1, 15],
  months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  weekdays: [1, 2, 3, 4, 5]
})

console.log(Cron.equals(cron1, cron2)) // true
console.log(Cron.equals(cron1)(cron2)) // true (curried form)

See

Signature

declare const equals: { (that: Cron): (self: Cron) => boolean; (self: Cron, that: Cron): boolean; }

Source

Since v2.0.0