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

Validation error while generate cron string using cronBuilder #607

Open
yhinge opened this issue Aug 11, 2023 · 1 comment
Open

Validation error while generate cron string using cronBuilder #607

yhinge opened this issue Aug 11, 2023 · 1 comment

Comments

@yhinge
Copy link

yhinge commented Aug 11, 2023

Hi Team,

I am trying to use the cronBuilder like this.

        public static String getCronExpression(DailyRecurrence dailyRecurrence) throws Exception {
		CronBuilder cronBuilder = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
		TimeDTO time = TimeDTO.getTimeDTO(dailyRecurrence.getTime());
		cronBuilder.withYear(always());
		cronBuilder.withDoM(always());
		cronBuilder.withDoW(always());
		cronBuilder.withHour(on(time.getHour()));
		cronBuilder.withMinute(on(time.getMinute()));
		Cron cron = cronBuilder.instance();
		log.debug("Cron Expression  generated for dailyRecurrence:{} expression:{}",dailyRecurrence,cron.asString());
		return cron.asString();
	}

Now Am I supposed to specify only the hour and minute and nothing else because no matter what I specify I am getting the validation error message. An I using it incorrectly or my expectation is incorrect from CronBuilder
Invalid cron expression: 1 13 * * *. Both, a day-of-week AND a day-of-month parameter, are not supported.
If its something that I should be fixing from your documentation sorry to raise an issue. But I was not able to find any documentation.

@jmrozanec
Copy link
Owner

@yhinge, may we ask you for a PR replicating the issue? We will be grateful for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants