Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Invalid endDate parameter #67

@bili-jing

Description

@bili-jing

Description

When I use pulse.every, setting endDate has no effect. I set both startDate and endDate, but only startDate has an effect, and the task will continue to execute after the set endDate time has passed.

Code example

import Pulse from "@pulsecron/pulse";

const mongoConnectionString = '****';

const pulse = new Pulse({ db: { address: mongoConnectionString } });

pulse.define(
  "raintrip",
  async (job) => {
    console.log("raintrip job running");
    return;
  },
  {
    shouldSaveResult: true,
    attempts: 4,
    backoff: { type: "exponential", delay: 1000 },
  }
);

(async function () {
  // IIFE to give access to async/await
  await pulse.start();

  // Alternatively, you could also do:
  await pulse.every("* * * * *", "raintrip", {
    timezone: "Asia/Shanghai",
    startDate: new Date("2024-11-26T20:20:00"),
    endDate: new Date("2024-11-26T20:25:00"),
  });

Additional context

"@pulsecron/pulse": "^1.6.7"

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions