Tracking time spent on work using Google Calendar intergration?

Hi.
I’m a bit of a coding/yaml newbie.

I’m trying to set up an automation using the google calendar integration so home assistant puts the time spent at work in my calendar.

But looking over the documentation I’m not clear on how to format start_date_time & end_date_time of the events to be set at the time i enter or leave the work-zone i have set up.

It wold be cool if i was able to get home assistant to save the time i entered the zone and create the event when i exit the zone using
start_date_time = date and time i entered the zone that day
and
end_date_time = current date and time when exiting
And as a bonus creating an event every Monday at 00:00 with XX hours and XX minutes spent at work the week before.

Perhaps here’s already a better solution i have been unable to find out there?
Thanks in advance!

It would be easy to track your arrival time and departures separately. Combining them into a single entry would take more effort, but should be doable.

e.g. Create 2 toggle/boolean helpers. One for when you arrive and one for leaving.
Then 2 automations. One each to trigger the booleans on when you enter/exit work zone

Then 1 final automation (also triggered on leaving work zone) to use the last_changed timestamps and use them in a google.create_event to insert it into your calendar
Followed by a second action to reset the toggles back to an off state ready for the next work day