| 707 | readonly onDstOverlap?: Cron.DstOverlapPolicy | undefined |
| 708 | }): Schedule<Duration.Duration, unknown, Cron.CronParseError> |
| 709 | } = (expression: string | Cron.Cron, tz?: string | DateTime.TimeZone, options?: { |
| 710 | readonly onDstOverlap?: Cron.DstOverlapPolicy | undefined |
| 711 | }) => { |
| 712 | const parsed = Cron.isCron(expression) ? Result.succeed(expression) : Cron.parse(expression, tz, options) |
| 713 | return fromStep(effect.map(effect.fromResult(parsed), (cron) => (now, _) => { |
| 714 | if (now === Number.POSITIVE_INFINITY) { |
| 715 | return Cause.done(Duration.zero) |
| 716 | } |
| 717 | return effect.sync(() => { |
| 718 | let next = Cron.next(cron, now).getTime() |
| 719 | if (Duration.isZero(Duration.millis(next - now))) next = Cron.next(cron, next).getTime() |
| 720 | const duration = Duration.millis(next - now) |
| 721 | return [duration, duration] |
| 722 | }) |
| 723 | })) |
| 724 | } |
| 725 | |
| 726 | /** |
| 727 | * Returns a schedule that recurs once after the specified duration. |