jmrozanec / cron-utils

Cron utils for parsing, validations and human readable descriptions as well as date/time interoperability.
http://cron-utils.com
Apache License 2.0
1.15k stars 262 forks source link

Incorrect description for 0 59 10 ? 1/2 MON#1 * #126

Open maheshneogi opened 8 years ago

maheshneogi commented 8 years ago

Actual result : at 10:59 every February months Monday 1 of every month

Expected Result : SOMETHING LIKE "The 1st Monday of every two months at 10:59"

jmrozanec commented 8 years ago

@maheshneogi thank you for reporting this - the description proposed looks much better :) Can we add a test case for this? I will be glad to accept the pull request. Thanks!

fante76 commented 7 years ago

It seems there is a problem with iterations syntax. I found same problem with: Expression: 0 15/4 12 * * ? Description: every 4 minutes at 12 hour Next start: Tue Nov 08 12:15:00 CET 2016

"Next Start" is calculated using org.apache.logging.log4j.core.util.CronExpression

The original code is:

try {
    CronDescriptor cd = CronDescriptor.instance(Locale.ENGLISH);
    CronParser parser = new CronParser (CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
    final String cronExpression = "0 15/4 12 * * ?";
    Cron c = parser.parse(cronExpression);
    System.out.println("Expression:\t"+cronExpression);
    System.out.println("Description:\t"+cd.describe(c));
    CronExpression ce = new CronExpression(cronExpression);
    System.out.println("Next start:\t"+ce.getNextValidTimeAfter(new Date()));
} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
jmrozanec commented 7 years ago

@fante76 I agree. Currently I would need more time to come back with a better way to get descriptions. If you have ideas / proposals, I will be glad to discuss.

fante76 commented 7 years ago

As you, if I could catch some extra time I will get a look in to the code.

Il 09/nov/2016 10:57, "jmrozanec" notifications@github.com ha scritto:

@fante76 https://github.com/fante76 I agree. Currently I would need more time to come back with a better way to get descriptions. If you have ideas / proposals, I will be glad to discuss.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jmrozanec/cron-utils/issues/126#issuecomment-259375413, or mute the thread https://github.com/notifications/unsubscribe-auth/AMXOMAbhizgzErSRpVxosp2zErO07aZBks5q8ZkFgaJpZM4KWzce .

Naxos84 commented 6 years ago

So you are looking for something that is working like: https://www.freeformatter.com/cron-expression-generator-quartz.html ?

jmrozanec commented 6 years ago

@Naxos84 we are looking to get that quality level of descriptions, but with the flexibility that cron-utils can provide regarding parsing expressions. We created a specific milestone to tackle this improvement. Probably some major changes will be required. Any thoughts on this are appreciated!

Naxos84 commented 6 years ago

Ok. I am going to think about this as soon as I am more comfortable with the project.

Am 17.11.2017 13:43 schrieb "jmrozanec" notifications@github.com:

@Naxos84 https://github.com/naxos84 we are looking to get that quality level of descriptions, but with the flexibility that cron-utils can provide. We created a specific milestone https://github.com/jmrozanec/cron-utils/milestone/8 to tackle this improvement. Probably some major changes will be required. Any thoughts on this are appreciated!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jmrozanec/cron-utils/issues/126#issuecomment-345234219, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_OIRe5wD7cppwZmpAkr-LrOGoiXFTZks5s3X9ZgaJpZM4KWzce .