Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By NAlvarado
#815096
I have 2 dates in the dynaform formatted as DD-MMM-YYYY. How do I find the difference in days between these 2 fields? I googled a few things but nothing seemed to work. Thanks!
User avatar
By amosbatto
#815103
Do it this way:
Code: Select all
function differenceInDays(startDate, endDate) {
  var oEnd = moment(endDate);
  var oStart = moment(startDate);
  var result = '';
  
  if (oStart.isValid() && oEnd.isValid()) { 
    result = moment.duration(oEnd.diff(oStart)).asDays();
  }
  
  $("#differenceInDays").setValue(result);
}  

$("#projectStarts").setOnchange(function(newVal, oldVal) {
  differenceInDays( newVal, $("#projectEnds").getValue() );
})

$("#projectEnds").setOnchange(function(newVal, oldVal) {
  differenceInDays( $("#projectStarts").getValue(), newVal );
})
(4.69 KiB) Downloaded 227 times

Being the best in the started business is the obje[…]

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]