samedi 5 mai 2018

How to disable specific dates on DatePicker in Materialize 1.0?

Before it was really easy to disable a specific date with the option disable:

$('.datepicker').pickadate({
  disable: [
    new Date(2015,3,13),
    new Date(2015,3,29)
  ]
})

But now It only has an option called disableDayFn which as far as I know, works something like this:

disableDayFn: function(date) {
   return date.getDay() == 1 || date == new Date(2018, 26, 5); //Not working
},

The part about getDay disables every first day on the datepicker (sunday or monday or whichever you have configured) but I haven't been able to disable a specific date, I also tried using getDate() but it disables a specific day number on every month, not an specific one. I've been trying for hours to figure it out.




Aucun commentaire:

Enregistrer un commentaire