Hyperlinkv0.8.0-beta.28

Cron

Cron.equalsconsteffect/Cron.ts:1099
(that: Cron): (self: Cron) => boolean
(self: Cron, that: Cron): boolean

Checks whether two Cron instances have the same field restrictions.

When to use

Use to directly compare whether two cron schedules have the same field restrictions.

Details

The comparison checks seconds, minutes, hours, days, months, and weekdays. It does not compare the optional timezone.

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)
predicatesEquivalence
Source effect/Cron.ts:10994 lines
export const equals: {
  (that: Cron): (self: Cron) => boolean
  (self: Cron, that: Cron): boolean
} = dual(2, (self: Cron, that: Cron): boolean => Equivalence(self, that))