Describe day of week is incorrect
CronDescriptor descriptor = CronDescriptor.instance(locale); CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(QUARTZ); CronParser parser = new CronParser(cronDefinition); Cron quartzCron = parser.parse("0 0 8 ? * SUN *"); descriptor.describe(quartzCron); //returns "at 08:00 at Monday day" instead of "at 08:00 at Sunday"
Same for all days of week lag of 1.
This still happen :(
@ElazarNeeman thank you for reporting the issue. @ElazarNeeman @RafaelAbreu05 You are welcome to contribute a test for it. A fix is always welcome as well :)
Seems you have FieldDayOfWeekDefinitionBuilder.mondayDoWValue = 1 and use CronDefinitionBuilder.quartz ... .withMondayDoWValue(2)...
Probably by just using 1 there to match it should fix the issue I would think
@MrForms thank you for the insight. Won't you mind sending a PR with the fix? I would highly appreciate that! Thanks!
@MrForms and @jmrozanec this doesn't work.
First I use the Cron Type Quartz that already have this option and didn't work:
CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ); (..) .withDayOfWeek().withValidRange(1, 7).withMondayDoWValue(2).supportsHash().supportsL().supportsW().supportsQuestionMark().and() (..)
After I tried manually defining myself the cron trype and the problem persists.
After some debugging I notice the problem is because you use the DateTime (Joda time API) and this API only supports:
public static final int MONDAY = 1; public static final int TUESDAY = 2; public static final int WEDNESDAY = 3; public static final int THURSDAY = 4; public static final int FRIDAY = 5; public static final int SATURDAY = 6; public static final int SUNDAY = 7; (http://joda-time.sourceforge.net/userguide.html)
return new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale());
@ElazarNeeman Thanks for the insight. If you have some time, I would appreciate a PR for the test and fix as well. Thanks!
@ElazarNeeman @RafaelAbreu05 @MrForms Many thanks to @markash for solving this issue!
@ElazarNeeman @RafaelAbreu05 @MrForms @markash version 6.0.0 was released with this!