Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #213
We were converting the start and end time to utc, which caused us North Americans to have a 9-5 translate to something like 17 - 1 after utc conversion.
I ended up re-writing the function (sorry 😄).
Basically we loop between the
earliest_booking
and the end time (eitherschedule_end
orfarthest_booking
), check if it's a valid day within the schedule's weekday selection, and finally build that days slots between thestart_time
andend_time
(accounting for the timezone conversion issue.)There's a few problems with this (and I believe also the previous code but correct me if I'm wrong!) where the
earliest_booking
time doesn't account for bookable days, just any day that comes up. So if I only allow people to book me on weekdays, and I have my earliest booking set to 24 hours, then people can still book me on Monday.That ux is kind of weird too, I'm not sure if I fully remember how that should work. Maybe a thing to discuss at the next meeting 😄