# Date range constraints

**URL:** <https://forum.bubble.io/t/date-range-constraints/224935>\
**Category:** Need help\
**Created:** [September 19, 2022, 12:14pm UTC](https://forum.bubble.io/t/date-range-constraints/224935 "2022-09-19T12:14:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_07](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@Rob\_07](https://forum.bubble.io/u/Rob_07)\
**Post date:** [September 19, 2022, 12:14pm UTC](https://forum.bubble.io/t/date-range-constraints/224935/1 "2022-09-19T12:14:36Z")

</div>

What is the best way to constraint this Rg to show these dates from this dropdown

 ![Screenshot 2022-09-19 221349](https://us1.discourse-cdn.com/bubble/original/3X/9/0/909f8f2a9871a955baf6ac8be3833eba1c5ad4cc.png)

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [September 19, 2022, 12:37pm UTC](https://forum.bubble.io/t/date-range-constraints/224935/2 "2022-09-19T12:37:55Z")

</div>

Obviously, it depends a bit on what kind of dates you’re searching for - i.e. dates which can’t possibly be in the future (such as ‘Created dates’ or dates of things which have happened), or dates of things which _can_ occur in the future (like due dates or birthdays etc.), and also how you want to define things like ‘Last 7 days’ (i.e. does that mean 7 days prior to the current date/time, or 7 days prior to the current Day etc.)…

But here are the general principles…

Today:

`Date ≥ Current date/time: rounded down to Day`  
`Date < Current date/time: rounded down to Day: + (Days) 1`

Yesterday

`Date ≥ Current date/time: rounded down to Day: + (Days) -1`  
`Date < Current date/time: rounded down to Day`

Last 7 Days

`Date ≥ Current date/time: + (Days) -7`  
`Date < Current date/time`

Last 30 Days

`Date ≥ Current date/time: + (Days) -30`  
`Date < Current date/time`

This Month

`Date ≥ Current date/time: Rounded down to Month`  
`Date < Current date/time: Rounded down to Month: + (Months) 1`

Previous Month

`Date ≥ Current date/time: Rounded down to Month: + (Months) -1`  
`Date < Current date/time: Rounded down to Month`

---

<div class="post-metadata">

**Author:** ![Rob\_07](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@Rob\_07](https://forum.bubble.io/u/Rob_07)\
**Post date:** [September 19, 2022, 12:51pm UTC](https://forum.bubble.io/t/date-range-constraints/224935/3 "2022-09-19T12:51:51Z")

</div>

Thanks for the quick response - I’m trying to implement it now .

---

<div class="post-metadata">

**Author:** ![Rob\_07](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@Rob\_07](https://forum.bubble.io/u/Rob_07)\
**Post date:** [September 20, 2022, 12:25pm UTC](https://forum.bubble.io/t/date-range-constraints/224935/4 "2022-09-20T12:25:07Z")

</div>

Thanks for your help. I don’t know if it’s the most efficient way of doing it but it works

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [November 28, 2022, 12:14pm UTC](https://forum.bubble.io/t/date-range-constraints/224935/5 "2022-11-28T12:14:54Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
