open_hours icon indicating copy to clipboard operation
open_hours copied to clipboard

Find next open slot when given a timestamp

Open kwando opened this issue 6 years ago • 2 comments

It would be useful to get the next open slot for a given time.

When will the store be open next?

(You can currently get this information from the between function if you craft your arguments accordingly).

kwando avatar Jul 11 '19 10:07 kwando

Hi @kwando 👋

Thanks for your suggestion. I'm thinking about adding this function to the TimeSlot module.

def from(%Schedule{} = schedule, %DateTime{} = instant, limit // 1) do
end

This function will return as many %TimeSlot{} as you provide in the limit parameter. WDYT?

hopsor avatar Jul 16 '19 16:07 hopsor

I've pushed #2 to implement your suggestion. Feedback is welcome

hopsor avatar Jul 16 '19 18:07 hopsor