Nintex Forms: Set min date and max date for date time picke

  • 13 September 2019
  • 1 reply
  • 29 views

Badge

Hello,

 

I have two date time picker. They should represent the travel time.

The 'ArrivalDate' starts (minDate) with the current date.

The 'LeaveDate' starts (minDate) with the 'ArrivalDate', so the user can't select any date before the arrival date.

 

Additionally I got tow more date time picker: 'OutwardFlightDate', 'ReturnFlightDate'.

The 'OutwardFlightDate' starts (minDate) with the 'ArrivalDate' and ends (maxDate) with the 'LeaveDate'.

The 'ReturnFlightDate' starts (minDate) with the 'ArrivalDate' and ends (maxDate) with the 'LeaveDate'.

 

Now I only can set the value for all the date time picker (minDate = new Date ()):

 

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

 

Thank you for your help,

Ronja


1 reply

Badge +2

Try this JS

 


NWF.FormFiller.Events.RegisterAfterReady(function () {

 NWF$('#'+ArrivalDate ).change(function()
 {
  var dateval=NWF$('#'+ArrivalDate).datepicker('getDate');
  NWF$('#'+LeaveDate ).datepicker('setDate', dateval);
  NWF$('#'+LeaveDate ).datepicker('option',{minDate: new Date(),maxDate: dateval});
 });
});

Reply