-4

I have the following jQuery code:

$(".dtp").datetimepicker({
    format: 'Y-M-D hh:mm',
    minDate: new Date()
});

I am using datetimepicker from Bootstrap and I'm trying to disable some days, based on information in my database.

For example all Mondays and Saturdays could be disabled. I can't seem to find information about how to do this.

dovetalk
  • 1,995
  • 1
  • 13
  • 21
  • try to google [bootstrap datetimepicker disable days](https://www.google.fr/search?safe=off&ei=GsevWojZLImkUZKkicAC&q=bootstrap+datetimepicker+disable+days&oq=bootstrap+datetimepicker+disable+days&gs_l=psy-ab.3..0i203k1j0i22i30k1l6.2460.2460.0.3258.1.1.0.0.0.0.87.87.1.1.0....0...1c.1.64.psy-ab..0.1.87....0.x0LdxhSicb8) – Logar Mar 19 '18 at 14:21
  • Possible duplicate of [Bootstrap datetimepicker disable past dates & current date?](https://stackoverflow.com/questions/43610281/bootstrap-datetimepicker-disable-past-dates-current-date) – Rickless Mar 19 '18 at 14:47

2 Answers2

1

Check this link, you can use disabledDates :

$(".dtp").datetimepicker({
    format: 'Y-M-D hh:mm', 
    minDate: new Date(),
    disabledDates: [
         moment("12/25/2013"),
         new Date(2013, 11 - 1, 21),
         "11/22/2013 00:53"
    ]
 });
Hamza Abdaoui
  • 2,029
  • 4
  • 23
  • 36
1

The latest version of datepicker has this option.

http://bootstrap-datepicker.readthedocs.io/en/latest/options.html#daysofweekdisabled

See Answer in this similar question

Limit bootstrap-datepicker to weekdays only?

heakinakai
  • 66
  • 1
  • 3