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

Disable recurrent days. #707

Open
cristiandaulisio opened this issue Nov 18, 2020 · 1 comment
Open

Disable recurrent days. #707

cristiandaulisio opened this issue Nov 18, 2020 · 1 comment

Comments

@cristiandaulisio
Copy link

Hello,
is it possible disable (for example) all saturday of each month and year?
or disable 25 dicember of each year?
etc.

@nadiminti
Copy link

First get a list with your required dates - "holidaydata". You can use do while loop to get the Saturdays and Sundays for the given time period and add along with your other holdiays to this list.

Using setDisabledDays(disbledDays) you can disable these days.

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); java.util.Date date = null; for (String holidaydatum : holidaydata) { try { date = sdf.parse(holidaydatum); } catch (ParseException | java.text.ParseException e) { e.printStackTrace(); } calendar = dateToCalendar(date); List<Calendar> dates = new ArrayList<>(); dates.add(calendar); Calendar[] disbledDays = dates.toArray(new Calendar[dates.size()]); dpd.setDisabledDays(disbledDays); }

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