Calculating quarters between dates with JavaScript
Hello,
I have two boxes that capture input for time and date. I need to calculate the number of quarters between the input but I'm new to JS so I'm not sure where to start.
I have the formula in Excel with A4 being estarrival and B4 being estdeparture
=ROUNDUP((B4-0.0416666666666667-A4)*4,0)
How can I make this in Javascript?
So far, I only have:
var f = this.getField("estdeparture").value;
event.value = f;
I'm thinking something like this but it's not giving me a value obviously because "this.getField("estdeparture").value;" is giving me the literal string when i try some basic debugging.
var depart = this.getField("estdeparture").value;
var return = this.getField("estreturn").value;
var final = return - 0.0416666666666667 - depart * 4;
event.value = final;
Any help is appreciated!