If you are using Zapier to take time entries from Toggl and put them into an invoicing system like Clio, like in these templates, you might run into a problem.  Toggl has settings for rounding up time entries, but those setting do not apply to data that is sent over the API to Zapier.

So, if you have a time entry in Toggl of 16 seconds, the fields sent to Zapier will be:

Duration: 16

Duration Readable: 00:00:16

Duration Hours: 0.0

So, we know that duration hours is being truncated to one decimal place, and that it is not always rounding up.  Assuming that it is doing standard rounding, that means that Toggl is rounding down your time entries half of the time.  If you make 10 time entries per weekday, and have a billable rate of $200, that’s a rounding error that is costing you $2000 a month!

Unfortunately, an hours duration is what Clio is looking for in it’s create time entry action,  so most people will attach the Duration Hours field to the Create Time Entry action, and shoot themselves in the foot.

In order to give effect to your rounding policy you need to use a Code by Zapier action to be able to convert 16 seconds into 0.1 hours.

Here’s how.

  1. Create a Zapier Code entry, and set it to JavaScript.
  2. As an input, take the Duration field from the Toggl entry and name it “duration”.
  3. For the text of the script, use the following

var roundedhours = Math.ceil(Number(input.duration)/360)/10;
output = [{RoundedHours: roundedhours}];

It should look like this:

roundedhours

Note that this is designed specifically to take a duration in seconds and convert them into tenths of an hour, rounded up.  If you are rounding to a different fraction, you are going to need to use different values for 360 (the number of seconds in 6 minutes) and 10 (the number of 6 minutes increments in an hour) in the script.

Save $2000 a month by rounding Toggl Time Entries with Code by Zapier
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *