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.14k stars 261 forks source link

Incorrect description for Quartz Cron Expression: 0 0 11 L-2 * ? #308

Closed LennyKarpel closed 3 years ago

LennyKarpel commented 6 years ago

Currently the description returned is 'at 11:00 last day of month'. Should be described as happening at 11:00 two days before the end of the month.

jmrozanec commented 6 years ago

@LennyKarpel Thank you for reporting this! May we ask for a PR with a test for this issue? Happy New Year!

LennyKarpel commented 6 years ago

@jmrozanec Happy New Year to you too !!

I am new this this. How do I create a PR if I cannot create a branch to put the changes on ?

The test would be something like:

@Test
public void testIssue308()
{
    CronDefinition    cronDefinition = CronDefinitionBuilder.instanceDefinitionFor( CronType.QUARTZ );
    CronParser        parser = new CronParser( cronDefinition );
    Cron              quartzCron = parser.parse( "0 0 11 L-2 * ?" );
    CronDescriptor    descriptor = CronDescriptor.instance( Locale.getDefault() );
    String            description = descriptor.describe( quartzCron );

    // not sure what the exact string 'should' be ..

    assertNotEquals( "at 11:00 two days before the last day of month", description);
}

anyway .. hope that helps. Let me know if I can do more.

Naxos84 commented 6 years ago

Fork this repo. Then add your branch (if you like). Push the changes to your forked repo. After that you can create the pull request.

Am 30.12.2017 18:09 schrieb "Lenny Karpel" notifications@github.com:

@jmrozanec https://github.com/jmrozanec Happy New Year to you too !!

I am new this this. How do I create a PR if I cannot create a branch to put the changes on ?

The test would be something like:

@Test public void testIssue308() { CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor( CronType.QUARTZ ); CronParser parser = new CronParser( cronDefinition ); Cron quartzCron = parser.parse( "0 0 11 L-2 * ?" ); CronDescriptor descriptor = CronDescriptor.instance( Locale.getDefault() ); String description = descriptor.describe( quartzCron );

// not sure what the exact string 'should' be ..

assertNotEquals( "at 11:00 two days before the last day of month", description);

}

anyway .. hope that helps. Let me know if I can do more.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jmrozanec/cron-utils/issues/308#issuecomment-354556843, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_OIcDVD31T7zeziBeHODoZ4eaD6-8Wks5tFm4-gaJpZM4RPhhD .

pangyikhei commented 3 years ago

@jmrozanec I can tackle this one.

jmrozanec commented 3 years ago

@LennyKarpel @Naxos84 Fixed by @pangyikhei in #458!