CalcBuilder Forum

Type Date - Can I dsable Saturday and Sunday?

Usuario moon_1905 2017-07-13 16:51:11

Hi Moonsoft-Team,

can I disable the date on Saturday and Sunday?

So that it is not clickable?

Thank you

Best regards

Moonsoft support 2017-07-14 08:30:07

Hi,
yes, you can disable weekends, adding a line at the first js tabs of your calculator (on loaded page). If your field date is called, for ex, mydate , you can write:

CB('input').datepicker({ beforeShowDay: CB.datepicker.noWeekends });

This should do the work.

Another quick tip, you can also force the day selected to be in the future, disabling past dates, this way:

CB('input').datepicker({ minDate: 0,beforeShowDay: CB.datepicker.noWeekends });

playing with minDate number you could also set the day selected must be always at least 5 days in the future..

CB('input').datepicker({ minDate: 5,beforeShowDay: CB.datepicker.noWeekends });



..etc

Hope this helps, regards

Usuario moon_1905 2017-07-18 11:12:22

Hi Moonsoft Team,

it's work!

Thanks for the detail tips.

Best regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!