Restricting Dates on Calendar

Thanks to Nicolas for helping out on this one:


$(document).on('knack-view-render.view_xx', function (event, view, data) {
$('#view_xx-field_xxx').datepicker('option', {
	maxDate: 0



This will make the user unable to pick a date in the future on the form. Just replace your view and field where the XX’s are. 

To restrict to only dates in the future, simply change maxDate: 0 to minDate: 0

Does this work ?

$.datepicker.setDefaults({ minDate:'0' }); 

Here's a good tutorial on DatePicker



I tried to use this code to prevent users to pick date in the past but it does not seem to work for me. I did replace maxDate = 0 by minDate=0. Please advice. Thank you!

Hey great, thanks for sharing Craig!