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

cannot get description for * and ? character from cron expression #482

Closed hemraj-ghanchi closed 3 years ago

hemraj-ghanchi commented 3 years ago

For the cron expression "0 0/1 ?" , i am getting description as "every minute", i am not getting description for and ? character. so please help. code like below

CronDescriptor descriptor = CronDescriptor.instance(Locale.ENGLISH); CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);

CronParser parser = new CronParser(cronDefinition);

String description = descriptor.describe(parser.parse"0 0/1 * ?"));

jmrozanec commented 3 years ago

@hemraj-ghanchi thank you for reporting this. What is the reference cron definition? The description seems right since '*' symbolizes 'every' and '?' is used in some cron definitions when a single field can be specified (e.g., DoW or DoM, but not both).

hemraj-ghanchi commented 3 years ago

0 30 12 ? =>> At 12:30 Every Day ... But current Came at 12:30 Only

jmrozanec commented 3 years ago

@hemraj-ghanchi this seems accurate as well ...

kamlesh0606 commented 3 years ago

@jmrozanec ,

Thanks For support.

currently , 0 30 12 ? wise display "12:30" But it is work as daily run on 12:30 . So I think display Like "Daily At 12:30". it is fully understandable Detail for Non-IT Person.

jmrozanec commented 3 years ago

@hemraj-ghanchi I agree with the comment. Perhaps you can provide a PR with the test for this use case, and we open an issue to fix it. Thanks! 😄