Hi folks, I am challenged by the following task.
Context
My app is the booking engine. I am creating an interface for hosts, and I want to enable them to easily pick dates (not necessarily individual dates) when they are not available. Such dates then would be excluded from proposed booking dates for their customers.
As a date input tool I am using Air Date/Time picker (Air Date/Time Picker Plugin | Bubble). It allows picking single dates and date ranges OR multi-date selector.
Challenge
Now, when host would use date range or multi-date selectors, those are to be saved into database as, respectively, date ranges, or date lists - that’s how Air Date/Time picker works with batch selections of dates.
For example:
Date range: 01/10/2021 - 31/10/2021
Date list: 01/10/2021, 15/10/2021, 31/10/2021
However, for some further use cases, those formats are not very convenient, and I would like to be able to split those by days.
Examples
-
I would like to split date list into individual dates (and be able to store them in DB or use on UI statically), like:
Date list 01/10/2021, 15/10/2021, 31/10/2021 should become
Date 01/10/2021
Date 15/10/2021
Date 31/10/2021 -
Similarly, I would like to extract dates that comprise the date range 01/10/2021 - 31/10/2021, i.e. obtain separate 31 records that I could then re-save, for example.
Is there a way of achieving this?
Thank you