Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Podio calculation adding duration to getTime if no getTime() entered in item

I am new here and not a programmer. Any guidance would be appreciated. Even just what to search to solve this myself.

I have a getTime calculation - Lunch time duration + Travel time duration = Total hours. I added a travel duration field that I need to add to my calculation. Problem is if there is no time in/timeout entered, the calculation won't add Travel duration. I think I need if no getTime then getTime = 0. Just not sure the code or what to search. Below is my current calculation fields:

Time in calculation

var y=moment(@Time In 1).subtract(6, 'hours').format("HHmm");
y=="Invalid date"?" ":y;

Time out calculation

var y=moment(@Time Out 1).subtract(6, 'hours').format("HHmm");
y=="Invalid date"?" ":y;

Total hours calculation

var x = Math.abs(@Time Out 1.getTime()-@Time In 1.getTime());
var y = x/1000/60/60;
var z= y - @Lunch1 + @Travel1;
z

Thanks so much in advance.

Comments