Limited Time Offer: Watch All Our Bubble Tutorial Videos for Only $99 per Year!

Here's a quick tip. When working with dates in your bubble app, in this bubble tutorial, I'm going to demonstrate how you can work with weeks, particularly if you want to be filtering events or date data in your bubble app by week. So I'm going to be demoing this with this calendar I've got going here.

Demo

We release more videos every single week. So like, and subscribe this one if you're watching on YouTube. And yeah, that's the great place to join and to learn no code and learn bubble with other people just like you. Let's dive into this demo. So let me first of all highlight what's frustrating.

Working with Date Constraints

So if I go into search for events at the moment based on this previous demo, I've got clear it out. That's from an old demo. Let's work with this. I want to be able to add a constraint in about week. And so I can go in and I can say date equals or date greater than, less than.

I mean, there probably is a way to do that with constraints. The other thing I can do, which I'm just demonstrating, but basically demonstrating how it doesn't help us, but how you can get to week data, is that in the cell for an event, I can go current cells, event date, and then I can go extract and I can extract week. And so that's going to be a week number assigned within the calendar calculations in the software. So if I refresh it, we should see. Okay, there we go.

So week five, first of first week of February, week six, second week of February. But if I go back into the constraints, I can't take the extract value at this point. So this is my workaround. If you've got a better way to do it, please, by all means, reach out, leave a comment. But I effectively create a stamp.

So I would say when we create the event, I'm going to add in a field, I'm going to make it a text field. Not going to call it text, I'm going to call it week stamp.

Creating a Week Stamp

And then what I'm going to do is say the date, but then formatted as custom. And I found that this works quite well. So if I was just to take out the week number. And then my app was hugely successful and I'm still working on it in a year's time, then that's not enough because the dates in week five of next year would appear alongside dates in week five of this year. So that's why I started with the wise, that stands for year.

We can see a preview down here, what it looks like. And then I put a hyphen and I put Ww. And so that is meaning it takes the week number and if it needs to, it puts a zero before it. And the reason for doing that is so that if I wanted to, I could sort them alphabetically and then they would actually in fact be in order. So now I've got that field in place, I can go back and search my events and I can add in a constraint and I can say weekstamp equals and I just generate the current date times weekstamp in the same format as I've just done.

So, whoops, let's go back.

Deleting Events

So remember y w.

So it's going to look for an exact match with the data. Now, the two events I already have in the calendar, I need to delete those because they're missing that week stamp data.

Where am I working?

Adding Events

Preview.

So let's add in an event for the demo one and it's going to be this week, let's say tomorrow, create event and it shows up. But let's add in an event for next week and it shows in my calendar because I'm not constraining it by my week stamp, but it doesn't show it in my repeating group. So there you go. That's one way that you can apply a filter for a week is to create a text stamp with the year and the week number. Remembering the week number needs to be two digits.

Otherwise if you then rely on it being an alphabetical order, it's not going to work so well. But yeah, there you go. That's how you can work with weeks better in bubble. If you've got any other tips for working in dates, or any other questions for working with dates in bubble, please do reach out to us and we'd love to hear your feedback.

Latest videos

lockmenu