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

datesDisable option not working? #30

Open
freshface opened this issue Dec 11, 2023 · 2 comments
Open

datesDisable option not working? #30

freshface opened this issue Dec 11, 2023 · 2 comments

Comments

@freshface
Copy link

freshface commented Dec 11, 2023

When i use the datesDisable option like this:

const datesToDisable = [ new Date(2024, 0, 1)];
const datepickerEl = document.getElementById('datepicker');

new Datepicker(datepickerEl, {
    datesDisable: datesToDisable,
    todayHighlight: true,
    minDate : new Date()
});

It does not disable the first of januari 2024

@tagperfect
Copy link

Hei, same problem here. I can not disable dates. I tried different date formats, but nothing helped.

@tagperfect
Copy link

I got it solved, my issue was related to a typo in the options name, the correct option is "datesDisabled". Also need to mention that the date format must be as defined in the locale if you use it.

Example:

const datepicker = new Datepicker(datepickerEl, {
  language: document.documentElement.lang,
  format: "dd.mm.yy",
  weekStart: 1,
  autohide: true,
  minDate: "today",
  todayHighlight: true,
  datesDisabled: ["08.01.2024"],
  daysOfWeekDisabled: [0, 6],
});

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