Skip to content

Generated cron expressions sometimes incompatible with Quartz (e.g., 0/60 in seconds/minutes field) #19

@adechoudens

Description

@adechoudens

Hello 👋,

I noticed that some cron strings generated by this package are not valid according to Quartz’s cron validation rules.

For example, if you generate a cron like:

0/60 * * ? * * *

Quartz rejects it with the error:

Increment > 60 : 60

This happens because in Quartz, the valid ranges are:

  • Seconds: 1–59
  • Minutes: 1–59
  • Hours: 1–23

Therefore, increments (*/N or 0/N) must never exceed the maximum value of that field. In this case, 0/60 is invalid, and the highest possible value should be 0/59.


How to reproduce

  1. Go to https://freeformatter.com/cron-expression-generator-quartz.html (which uses this plugin).
  2. Generate a cron with an increment of 60.
  3. Copy/paste the generated cron expression in the input field next to the "Describe expression" button
  4. Use the "Describe expression" button.

➡️ You’ll see Quartz fail with the error:

Increment > 60 : 60

Suggested fixes

Fix in cron-core

path: @sbzen/cron-core/ui/utils/get-list.js

  • Adjust the logic so that when every = true and the context is Quartz cron, the generated list goes from 1 to 59 instead of 1 to 60. Same with the 1 to 24 range.

Thank you for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions