Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Time Calculations in a Table

Avatar

Level 2

I am creating a new timesheet Which uses a table with a add time/remove time buttons.

The basic table has a Time In row and a Time Out row. In the footer row Itotal each day. That is no problem as i am using the same script I use in other forms.

The problem occurs is when you click the Add Time button and now another instance of the Time In and Time Out rows are added.

How do I now calculate that time and add the 2 together. I can add up to an additional 2 instances. Below is my script for just calculating the basic time for Sunday.

Thanks,

Craig

 

var vTime1 = Times.TimeIn.in1Sun1.rawValue;

 

if (vTime1.length == 4 && vTime2.length == 4) {

var vTime1Minutes = parseInt(vTime1.substring(0, 1))*600 + parseInt(vTime1.substring(1, 2))*60 + parseInt(vTime1.substring(2, 4));

var  vTime2Minutes = parseInt(vTime2.substring(0, 1))*600 + parseInt(vTime2.substring(1, 2))*60 + parseInt(vTime2.substring(2, 4));

this.rawValue = (vTime2Minutes - vTime1Minutes)/60;

}

var  vTime2= Times.TimeIn.out1Sun1.rawValue;

0 Replies