Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect descriptor result #380

Open
kostya05983 opened this issue May 13, 2019 · 3 comments
Open

Incorrect descriptor result #380

kostya05983 opened this issue May 13, 2019 · 3 comments

Comments

@kostya05983
Copy link

Hello, @jmrozanec.
I use next cron expression 0 0 0 ? * 6 * and use class CronDescriptor.instanse(Msg.getCurrent()).describe()
I want to get at 00:00 at and Saturday day.
I get at 00:00 at and Friday days
I debug code and find that in DescriptionStrategyFactory, diff is always =-1, but if it is 0 result will be correct.

final Function<Integer, String> nominal = integer -> {
            int diff = definition instanceof DayOfWeekFieldDefinition ? DayOfWeek.MONDAY.getValue() - ((DayOfWeekFieldDefinition) definition).getMondayDoWValue().getMondayDoWValue() : 0;
            return DayOfWeek.of(integer + diff < 1 ? 7 : integer + diff).getDisplayName(TextStyle.FULL, bundle.getLocale());
        };
@jmrozanec
Copy link
Owner

@kostya05983 thank you for reporting this. We would appreciate if you can send a PR with the corresponding test. We will try to fix it as soon as possible and release a new version with it. Help is always welcome! 😄

@jmrozanec jmrozanec added this to the next milestone May 13, 2019
@kostya05983
Copy link
Author

@jmrozanec I understand that it is happened because the week starts on sunday, how do you think, is it possible to provide functionality to start week on monday?

@jmrozanec jmrozanec modified the milestones: 9.0.0, next Jun 17, 2019
@jmrozanec
Copy link
Owner

@kostya05983 please notice that we support Cron specifications to have a flexible start of week: you just need to specify which index corresponds to Monday at CronDefinitionBuilder: withMondayDoWValue(yourValueHere)
Please let us know if further explanations are needed. Best!

@jmrozanec jmrozanec modified the milestones: 9.1.2, next Nov 19, 2020
@jmrozanec jmrozanec modified the milestones: 9.1.5, next Apr 1, 2021
@jmrozanec jmrozanec modified the milestones: 9.1.7, next Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment