-
NASHIA30Asked on March 9, 2025 at 2:01 PM
I want to create a time off request form and calculate hours requested off. I would like to factor in weekends, an 8 hour workday, and partial day requests.
Page URL: https://form.jotform.com/250674873459168 -
Gian_D JotForm SupportReplied on March 9, 2025 at 4:35 PM
Hi NASHIA30,
Thanks for reaching out to Jotform Support. Can you explain a bit more about your goal so we can look for a way to achieve it?
Once we hear back from you, we'll be able to help you with this.
-
NASHIA30Replied on March 9, 2025 at 5:08 PM
-
Reymae JotForm SupportReplied on March 9, 2025 at 5:55 PM
Hi NASHIA30,
You can calculate the total hours of time request off on the Form Calculation Widget in your form. Let me show you how:
1. In Form Builder, click the Form Calculation Widget, and then click the Wand icon on the right side.
2. Enter the following values:
3. Click the Save button.
Check out the screencast below to see my result:
You might also want to check out this guide about How to Perform Calculations Using a Widget. Just to avoid confusion, I've moved your other question to a new thread and helped you there. You can check it out here.
Give it a try and let us know if you have any other questions.
-
NASHIA30Replied on March 10, 2025 at 8:55 AM
Thank you for that. However, we operate on of an 8 hour workday. How do I get it to account for 8 hours per day and not 24 hours per day? For example: If someone uses the widget to take off two days, I need it to calculate 16 hours and not 48 hours.
-
Roi JotForm SupportReplied on March 10, 2025 at 9:45 AM
Hi NASHIA30,
Thanks for reaching out to JotForm Support. I understand the issue, but I'll need time to move forward with the solution. I'll be replying to you shortly.
Thanks for your patience and understanding
-
NASHIA30Replied on March 10, 2025 at 3:31 PM
Thank you!
-
Roi JotForm SupportReplied on March 11, 2025 at 5:54 AM
Hi NASHIA30,
You just need to change the formula instead of calculating 24 hours to 8 hours. It's really easy. Let me show you how:
1. In Form Builder, click the Form Calculation Widget, and then click the Wand icon on the right side.
2.Enter the following values as you see on the picture below and click on Save.
Check out the screencast below to see my result:
Give it a try and let usknow if you have any other questions.
-
NASHIA30Replied on March 11, 2025 at 8:44 AM
Thank you for your reply. I did as instructed. I found that it works if someone takes off from one date at 8:00AM to the next day at 8:00AM (for example), but if I change the return time to 10:00AM, the calculation is off. Please advise.
-
Reymae JotForm SupportReplied on March 11, 2025 at 9:41 AM
Hi NASHIA30,
Can you share your working hours with us? This will allow us to adjust the formula to calculate the duration of your time off accurately within those hours. Specifically, we need to determine how much of the requested time off falls within working hours to ensure precise tracking. If that’s not exactly what you’re looking for, can you explain a bit more so I can help you better?
After we hear back from you, we’ll have a better idea of what’s going on and how to help.
-
NASHIA30Replied on March 11, 2025 at 9:47 AM
Sure! We work an 8 hour day from 8 - 4 each day. We do not work on weekends and some US holidays.
-
Reymae JotForm SupportReplied on March 11, 2025 at 10:41 AM
Hi NASHIA30,
It's really easy to calculate the exact duration of the leave with Time fields and Day Difference widget instead of a Date field. Let me walk you through it:
- In Form Builder, click on the Add Element menu on the left side of the page.
- Under the Basic tab, scroll down the list and choose the Time field.
- Now, just drag and drop it to your form.
You need to add four Time fields to your form for your Time of Beginning of Leave, Time Returning to Work, Working Hours Start, and Working Hours End. Next is to set the Value for the Working Hours Time Field. Let's do it:
- In Form Builder, select your Time field and click the Gear icon.
- Go to Options tab and set the Default Time to Custom and insert your working hours.
Then you can use a widget to calculate the Date difference:
- While in Form Builder, click on the Add Element menu on the left side of the page.
- Under the Widgets tab, scroll down the list and choose the Day Difference widget and drop it to your form.
- Click the Wand icon to set up the widget.
- Exclude the Weekends and enable the Calculate Difference feature.
You can clone and test my demo form here. Take a look at the screenshot below to see how it works:
Give it a try and reach out again if you have any other questions.