Adobe Acrobat Forms : Add a specific number at specific interval
I am trying to add a particular number at regular intervals
I have difference between 2 dates in hours
so for first 24 hours result 1 ,
even more than a minute to 24 hours >> result 1+.5 = 1.5 ,
then again even more than a minute to next 8 hours >> result 1.5 + .5 = 2
then again even more than a minute to next 16 hours >> result 2 + .5 = 2.5
then again even more than a minute to next 8 hours >> result 2.5 + .5 = 3
then again even more than a minute to next 16 hours >. result 3 + .5 = 3.5 and so on.
In short .5 to be added after 24 hours for at every more than 8 hours & 16 hours
I am using the below script but not able to achieve the above :
var miles = this.getField("minutes").value; //difference between days in minutes
var hrs = Math.floor(miles/(60*24)); //capturing the hours part
var min = miles%60 //capturing the remainder minutes
if(hrs == "0" && min > 0){event.value =1}
else if (hrs >0 && min >0) {event.value = hrs + ".5"}
else if (hrs > 0 && min == "0"){event.value = hrs}
