Date/time off by 1 hour (Toggl Track)

I’m trying to automate sending timesheets from Toggl Track to customers. It works, except… I cannot get the input time correct. The module has 2 inputs, “Since” and “Until”, the start- and endtime of the timesheet. This is where I cannot get it right. I basically want the report from Monday 0:00 until Sunday 23:59.

I use this function for “since" (ignore the date part… it’s the time part that’s causing me issues):
{{formatDate(addDays(addDays(now; 1); "-" + formatDate(now; "d")); "YYYY-MM-DD"; " UTC")}}
and this for “until":
{{formatDate(addDays(addDays(now; 2); "-" + formatDate(now; "d")); " YYYY-MM-DD"; " Europe/Amsterdam")}}

The time is correct in the bundle input on screen:

But, in the bundle input, it’s “2024-10-27T23:00:00.000Z”
Bundle content.txt (287 Bytes)

Unfortunately, this means Toggl creates the reporting including the day before.

I’ve used the formatDate function with both “Europe/Amsterdam” and “UTC”, it doesn’t make a difference. My organization timezone is set to Europe/Amsterdam. I was going to set it to UTC to see if that would fix it - but found that’s not an available timezone to set. I can set it to something in the UK, but that would still mess up with DST changes.

How can I get a formula to return 0:00:00 in UTC?

Hello,

Welcome to the community.

According to Toggl’s documentation, it requires the time in RFC 3339 format: YYYY-MM-DDTHH:mmZ

What worked for me:

{{formatDate(setMinute(setHour(formatDate(addDays(addDays(now; 1); "-" + formatDate(now; "d")); "YYYY-MM-DD"; "UTC"); 0); 0); "YYYY-MM-DDTHH:mm:ssZ"; "UTC")}}

If it works for you, you might want to optimize it, as the formula is a bit messy and overcomplicated.

Have a great day!

Thanks a lot! That was close, and did put me on the right track. Especially the required Toggl input format helped. Here’s what I used. Slightly ugly, but very functional:
{{(formatDate(addDays(addDays(now; -6); "-" + formatDate(now; "d")); "YYYY-MM-DD") + "T00:00:00Z")}}

2 Likes