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
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]