Skip to main content
Nintex Community Menu Bar

How to limit date picker range?

  • October 6, 2017
  • 5 replies
  • 243 views

Forum|alt.badge.img+2

Hello all!

I was curious if there is a way to limit the date/time control to only allow dates to be selected for past 7 days and current day, no further forward or back?

Thanks! 

5 replies

Forum|alt.badge.img+7
  • Nintex Partner
  • October 6, 2017

Not on selection, but you can define a validation rule that prevent the form to be submitted if date is not in your range.


Forum|alt.badge.img+2
  • Author
  • October 6, 2017

Found a javascript solution!

NWF$('#' + datebook).datepicker('option',{minDate: '-7d',maxDate: Current Date});

Thanks for the help! 


Forum|alt.badge.img+6
  • October 6, 2017

Thanks for the solution.

But this is a part of jQuery UI DatePicker , am i right ? To make use of your code one must have or refer the jQuery UI js file.


Forum|alt.badge.img+3
  • November 3, 2017

I was able to accomplish like this:

Set date picker min val to today:

NWF$(document).ready(function(){

NWF$.datepicker.setDefaults({minDate: new Date()});

});

this sets all datepickers. If I want to set just a single date picker to set the min date to be the date of another datepicker selection it doesn't work:

NWF$("#"+ minDval).on('change',function(){
var minD=NWF$("#"+ minDval).val();
var retD=NWF$("#"+rDval);

retDval.datepicker.setDefaults({minDate: new Date(minD)});
});

any ideas?


Forum|alt.badge.img
  • Nintex Partner
  • June 25, 2019

Hi @bcobra ,

 

Sorry my english isn't very well but I solved your question.

 

I did it to put min date to specific date picker in nintex forms.

NWF$('#' + varFechaDonacion).datepicker('option',{
minDate: new Date(),
});

 

Where "varFechaDonacion" is variable javascript