How to show days of the week in a repeating group dynamically?

This problem has been keeping me up at night, and while it feels like it should be simple, it is not.

I want to show a 7x1 repeating group which shows the next seven days, and I want it to update dynamically. For example, if it is Monday today, it will show the next seven days up to Sunday, and then tomorrow, it updates to show all days until Monday.

This is an example of what I would like to look like. Once I have that repeating group, I want to be able to show data within them which is linked to that day, for example, if a restaurant is open on Monday, it will show that booking are available that day in the repeating group.

Again, this feels like it should be obvious, but is not.

Thanks in advance!

Harry

I’d start by generating a list of dates, and use that as the RG data source.

Then just use some conditions on the internal content to display based on whether or not the Restaurant is open on that day.

Thanks for getting back to me. In terms of creating a list of dates, what would be the easiest way to do that, and secondly, do I need to create a list of dates for like 3 years into the future?

No, you just need to create a list of 7 dates… i.e. the next 7 days.

To generate the list of dates, you can either use a simple javascript loop, or a plugin such as this: 1T - List of Dates Plugin | Bubble

1 Like

Incredible, thanks so much. I’ll try this out and let you know if it works

Thank you. And what would be the best way to find the first day of the current week.
I used “current day rounded down to week” but it gives me a sunday.
I would like to have monday as the first day of the week without having to do “current day rounded down to week + 1”
Any idea?

Why? That’s how you do it…

Actually, it’s slightly more complicated than that as you have to account for Sundays… but in Javascript (and therefore in Bubble) weeks start on Sunday (0), so if you want to start your week on Monday you just have to adjust accordingly.

i.e. current date/time: plus days (-1): rounded down to week: plus days (1)

Thank you @adamhholmes. (-1) before “rounded down to week” is only to manage the case when current date is a sunday, is that right?