Skip to main content
Participating Frequently
August 27, 2018
Answered

Rounding a time calculation

I'm trying to make my service ticket that i created round our times in and out to the nearest .25 of an hour.

Here is what i have for the time calculation-

// determine the current row number

var ourName = event.target.name;

var matches = ourName.match(/.*(\d+)$/);

var rowNum = matches[1];

handleRow("h:MM tt", "StartTime", "StopTime", "BreakTime", "Overtime", rowNum);

But as of now it calculates just 1.34, 2.89. I want it to round down and up. So if its .12 hours round down to .00 and it if its .38 to round to .5 and so on.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
August 27, 2018

now im gettin a SyntaxError: Missing } in compound statement 56: at line 57


You've either added or removed a curly bracket that you shouldn't have...


Here's the edited file with working code: https://drive.google.com/open?id=188qGrMtVRjsif6MHP4euSaFDcrC0tRsB

12 replies

Participating Frequently
August 27, 2018

Im not sure what the handlerow is... my former coworker did all this stuff prior and he just stole the code from somewhere on the internet.

Translate
try67
Community Expert
Community Expert
August 27, 2018

We need the full code to be able to help you out. It might be easier if you could share the actual file with us (via Dropbox, Google Drive, Adobe Send & Track, etc.).

Translate
Participating Frequently
August 27, 2018

Thats the document

Service Ticket.pdf - Google Drive

Translate
Bernd Alheit
Community Expert
Community Expert
August 27, 2018

What is handleRow?

Translate
try67
Community Expert
Community Expert
August 27, 2018

Post the code of the handleRow function.

Translate