grahamar / cron-parser

Java Parser For Cron Expressions
MIT License
202 stars 59 forks source link

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

Open superbazza opened 2 years ago

superbazza commented 2 years ago

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 commented 2 years ago

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 * * *"));`