cron-parser icon indicating copy to clipboard operation
cron-parser copied to clipboard

Descrtiption for [0 */5 8-17 ? * *] is somewhat incorrect - and misleading

Open superbazza opened this issue 4 years ago • 1 comments

System.out.println(CronExpressionDescriptor.getDescription("0 */5 8-17 ? * *"));

The description is Every 5 minutes, between 8:00 AM and 5:00 PM

It should be Every 5 minutes, between 08:00 AM and 05:59 PM - https://bradymholt.github.io/cron-expression-descriptor/

Or, even better, it should be Every 5 minutes, between 8:00 AM and 5:55 PM

superbazza avatar Nov 12 '21 12:11 superbazza

Does this look good?

Assert.assertEquals("Every 5 minutes, between 11:00 AM and 12:55 PM", CronExpressionDescriptor.getDescription("*/5 11-12 * * *"));
Assert.assertEquals("Every 5 minutes, minutes 03 through 30 past the hour, between 11:03 AM and 12:28 PM", CronExpressionDescriptor.getDescription("3-30/5 11-12 * * *"));
Assert.assertEquals("Every 3 minutes, between 11:00 and 17:57", CronExpressionDescriptor.getDescription("*/3 11-17 * * *", Options.twentyFourHour()));
Assert.assertEquals("Every minute between 1:00 AM and 1:59 AM", CronExpressionDescriptor.getDescription("* 1 * * *"));`

superbazza avatar Nov 12 '21 20:11 superbazza