npm croner 11.1.0

one hour ago

Highlights

  • job.describe() describes a pattern in words, e.g. 0 12 * * MON-FRI gives
    "At 12:00, on Monday, Tuesday, Wednesday, Thursday, and Friday.". English is the default and
    swedish is included. You can pass your own language (type CronDescribeLanguage), or spread a
    built-in one to change parts of it, such as timeOfDay for a 12-hour clock. Returns undefined
    for date-based jobs. (#479)
  • LW in day-of-month lists, as in croner-rust: 0 0 L,LW * * and 0 0 1W,15W,LW * * now
    work. In 11.0.1, LW in a list threw an error. (#475, fixes #473)

Upgrade notes

  • Reusing a named options object for a second job now throws, because the name is already
    taken. Before, the second job was silently created without a name. (#471)
  • job.options is now a copy. Changing the object passed to new Cron() after the job is
    created (context, catch, protect, etc.) no longer affects the job. Croner also no longer
    changes your options object, so frozen or reused objects work. (#471, fixes #470)
  • Date strings without a time or offset are read as wall-clock time.
    • startAt: "2016-12-01" is 00:00:00 in the job timezone, or in local time when neither
      timezone nor utcOffset is set. Before, the result depended on the host timezone.
    • With timezone or utcOffset set, an ISO string without an offset keeps its time even when
      that time falls in a DST gap of the host timezone. (#478)
  • Day lists starting with * count as unrestricted (OCPS 1.0 §6.1). 0 12 *,1 * MON now runs
    on Mondays only, and 0 12 L,* * MON runs every day. (#477)

Fixed

  • alternativeWeekdays: true:
    • Ranges that end before they start, such as SAT-SUN, MON-SUN and FRI-MON, now wrap
      around the week, as in Quartz and croner-rust. (#474, fixes #472)
    • Day-of-week 8 now throws, as 0 already did. (#468)
  • SUN-SUN means Sunday only, instead of every day. (#469)
  • With interval and a startAt in the past, the next run is no longer skipped when it is more
    than one interval after the last run. (#480)
  • With timezone or utcOffset set, an ISO string ending in a lowercase z (allowed by
    RFC 3339) is read as UTC. (#481)

Docs

  • A fixed-time job in a DST gap that ends at midnight (e.g. America/Nuuk on 30 March 2024) does not
    run that day. This is now documented. (#467, fixes #466)

Maintenance

  • Updated rollup to ~4.69.0. (#476)

Contributors

Thanks to @zzoraemon043, @mansur-akhmadi, @yuyongyan29-dev, @kevincommits, @ohad6k and
@SaneSanders for their first contributions, and to @okarin2033 for reporting #466.

Full changelog: 11.0.1...11.1.0

Don't miss a new croner release

NewReleases is sending notifications on new releases.