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

Learn how to filter dates by this month in with this tutorial.

Filtering dates in

Let's be honest, working with dates in Bubble could probably be a bit easier. But in this Bubble tutorial video, I'm going to show you how you can filter by this month on a list of dates.

Adding the current month to a text label

So I'm going to start by adding it into this text label because then you can see what's going on behind the scenes. And then ultimately I'll be applying it as a constraint to this calendar. But you could equally do the same thing to a repeating group.

Join our bubble community for more tutorials

But before I launch into that, if you're learning Bubble, there's no better way than clicking the link down in the description. Heading over to the website, joining our community of Bubble builders, and learning from our hundreds of Bubble tutorial videos.

Filtering by the current month

So what are we doing? We are doing this month so we can say current date time rounded down to month, and let's see how that prints. So today is May 8, and then of course, we get back May 1, midnight, rounded down to the start this month.

Considering user time zones

Now just remember that this is relative to the user's time zone, and the user's time zone is provided by their browser. So you wouldn't get the same simultaneous instance in time if two different users rounded down the day or the month, but they were in different time zones because it's going to be relative to them.

Adding constraints for the current month

So we then need to basically sandwich it because that's it. That's all you need to do if you know that there's going to be nothing in the future. You just need to have one slice of the sandwich, which is don't go earlier than the start of this month.

Applying the constraints to the events data type

So let's place this into our constraints on our events data type here. We say date is equal to, and this is just a date field. You could have start date, end date, whatever you need to use, say current date, time rounded down to month.

Filtering events beyond the current month

Okay, but then what about if we did have events in our system that were later than this month? So we say date, oops, come back here. Now we just say less than. That's because we're going to actually target midnight of the first day of the next month.

Adjusting the filter for the next month

So we can say month, add one, and then now we round it down to the month. So that's what's today? I say May 8. So that's going to take us into the June 8, and then round it down to midnight June 1. And because I'm using the less than and not less than or equal to, it's actually going to be the moment before we move into June 1, which is perfect for here.


So there you go. That's how we can filter dates in by the current month.

Latest videos