Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Calculate time difference on subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 377
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Calculate time difference on subform

Unread post by kknm »

Understood! All OK !
The problem is in the line:

Code: Select all

if (a.val() == 1) {//was if (a == '1') 

Code: Select all

 updateDuration(t1, t2, d, a, e);
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Calculate time difference on subform

Unread post by kev1n »

Meaningful variable names help to make code more readable and easier to understand.

E.g. like this:

Code: Select all

var beg = $("#" + prefix + "pro_beg");
var end = $("#" + prefix + "pro_end");
var diff1  = $("#" + prefix + "pro_dif");
var diff2  = $("#" + prefix + "pro_diff");
var devNum  = $("#" + prefix + "pro_num");
kknm
Posts: 377
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Calculate time difference on subform

Unread post by kknm »

kev1n wrote:Meaningful variable names help to make code more readable and easier to understand.
Early rejoiced, Counts only the first line. - fixed.
I need to display the sum of the differences for each device
Post Reply