jquerydatetimepickerprocessmaker

set minDate on bootstrap datetimepicker 4.17.37


I use this function to resetting minDate:

$('#datetimepicker1').data("DateTimePicker").minDate(moment(myDate));

It's works perfectly on my scratch html page. But when I tried on my processmaker, it does not work and throws an error:

Uncaught TypeError: Cannot read property 'minDate' of undefined

here's my snippet code on processmaker:

$("#priority").setOnchange(setExpectedDate); //this no different with .change on jquery

function setExpectedDate(newVar, oldVar){
  
  var numWeek = 1;
  switch(newVar){
    case 1:
      numWeek = 7;
      break;
    case 2:
      numWeek = 5;
      break;
    case 3:
      numWeek = 3;
      break;
      
  }
  var d = new moment();
  d = moment(d).add(numWeek, 'weeks');
  $("#expectDate").getControl().data("DateTimePicker").minDate(d);
}

I am using processmaker version 3.3 and it's using datetimepicker 4.17.37, I tried on scratch with datetimepicker 4.17.47 (latest)

I've tried using this statement on processmaker :

$("#expectDate").getControl().datetimepicker({ minDate: d.format("YYYY-MM-DD")});

I have no error log by using code above, but it's doesn't makes the minimun date changed.


Solution

  • You can try with the below code. It will helps you.

    $('#expectDate').handleDtpicker('setMinDate', new Date(2020, 9, 12, 10, 20, 0));