Difference in Business Hours

edited January 4 in Beast Mode

I'm looking to get the difference in 'business' hours between two date/time fields. The business hour range is 9:00 - 17:00 (or 9am - 5pm), within weekdays.

Additionally, If a user enters a Start Date after 17:00, the start date should get pushed to 9:00 of the next business day.

For example, the following should have an output of 11 hours.

Start: 01/04/2022 11:00

END: 01/05/2022 14:00

I'm guessing this has been encountered quite a few times in the past, can anyone share what they've put together, even if it is just a starting point where I can adjust to my dataflow?

I am looking to perform this within a Beastmode.

I attempted using the solution within the topic listed below but am getting inconsistent results. https://dojo.domo.com/discussion/10059/how-can-i-show-an-age-between-2-time-stamps-in-business-hours