Hello Bubblers, need help. I am creating a shift management system and trying to add condition to create a new shift. Currently, built the feature to calculate the hours from date/time picker end to date/time picker start its works fine, but the issue is that i need to create multiples same shifts if the end date/time exceeds the first day (24:00) hours. Like i create shift like 03/12/24 15:00 to 03/15/24 22:00. It should create 4 new shifts with same time/hours range, while right now it create only one shift and calculate total hours from 03/12/24 15:00 to 03/15/24 22:00.
Multiple ways of doing it. Here’s what I’d do without using a complex plugin (though I’m sure that’s also a route you can go down, I try and stay as native as possible):
Get the 1T - List of Dates element (if you don’t know how to generate lists of dates using custom workflow loops, or, more likely, can’t be arsed with it)
In your UI, take a start date/time using a normal date/time picker. Then, have an input for duration (hours) which is a number.
Have an end date. Set the start date of List of Dates to the start date, and the number of dates to end date - start date:formatted as days:rounded to 0.
Schedule API workflow on the list of dates. The API workflow takes the date (which also includes the time), and the duration in hours. Inside the API workflow, create a new Shift starting at the start time, and ending at the start time +hours (the duration specified by the user).