JQuery Tools - disable weekend

I am looking for a solution to disable weekend (sat, sun) in jQuery Tools Datepicker. I know that there is a solution for jQueryUI, but I need this for this, because the project is almost 99% complete, so digging into the code for something is still not a good idea at this time.

http://flowplayer.org/tools/dateinput/index.html

+4
source share
3 answers

you can add something like this:

$(".date").dateinput({ change: function() { var dayOfWeek = this.getValue('ddd'); if( dayOfWeek === 'Sat' || dayOfWeek === 'Sun'){ this.hide(); return false; } } }); 

Further improvements:

  • You can open a warning window to alert the user that they cannot select the weekend.
  • you can create css style to disable weekend.
+2
source

I also ran into this problem and I got the following solution:

 var dateinput = $('input[type="date"]').dateinput({ "onShow": function(event) { var calendar = this.getCalendar(); var conf = this.getConf(); var classes = conf.css.off + ' ' + conf.css.disabled; function disableWeekends() { var weeks = calendar.find('.calweek'); weeks.find('a:first, a:last').addClass(classes); } calendar.find('#calprev, #calnext').click(disableWeekends); disableWeekends(); } }); 

https://gist.github.com/1031709

+1
source

I expanded on the treffin answer to handle the holidays.

jqueryTools date Enable non-cut-off weekends and holidays

0
source

Source: https://habr.com/ru/post/1332848/


All Articles