Coda paid time off (PTO) — 6.0
handle half days
During a demo, I was asked about handling half-days off, which I hadn’t initially considered. Employees in my region (Europe) can take full or half days of PTO. My first thought was to manually adjust the PTO count if half days were used, but this would disrupt my ‘next working day’ calculations and future plans to integrate with Google Calendar. I need a date-specific solution to accurately track PTO, including half days.
The solution I devised consists of two interconnected parts. Firstly, a table is required to present employees with various options.
Secondly, a logic system is necessary to assign these values (0.5 or 1) to specific dates, as illustrated below.
Crucial to this logic is the utilization of the first and last working days within a given period, which are then correlated with the selected option.
The logic for the last day can be derived by replacing First()
with Last()
in the existing logic for the first day.
While it’s feasible to integrate this logic directly into the function behind the ‘dayValue’ column, eliminating the need for the two additional columns, I prefer to retain them for enhanced clarity and ease of implementation when setting up the required function.
The most challenging variation involved the “First day & last day half day off” option. This required the creation of two separate arguments due to their row-specific nature, as this option pertains to both the first and last rows.
Finally, a button triggers the completion of the logic, pushing the data for each date (or row) into a balance system, where it is then allocated across months and years accordingly.
The resulting system successfully allows employees to take both half and full days of leave. However, this implementation raises the question of whether the remaining time off balance should be displayed in days or hours.
I hope this article was informative and helpful. Did it help you to solve a problem you unlike would have solved other ways? What about a donation?
My name is Christiaan, and I regularly blog about Coda. While this article is free, my professional services (including consultations) are not, but I’m always happy to chat and explore potential solutions. You can find my free contributions in the Coda Community and on X. The Coda Community is a fantastic resource for free insights, especially when you share a sample doc.