Notion Formula: Does Date Range Contain Today?

Screen Shot 2020-07-25 at 3.51.25 PM.png

⁉️ Contains Today

Inspired by a question I received on one of my YouTube videos, I solved the problem “does today land within a date range?” I used the function formatDate to find if start and end of range lands on today, and dateBetween to determine how many days span from now to both ends of the range.

The Formula

formatDate(end(prop("Date Range")), "MMM DD, YYYY") == formatDate(now(), "MMM DD, YYYY") or formatDate(start(prop("Date Range")), "MMM DD, YYYY") == formatDate(now(), "MMM DD, YYYY") or dateBetween(now(), start(prop("Date Range")), "days") > 0 and dateBetween(now(), end(prop("Date Range")), "days") < 0

Breakdown

Does today land on start of range?

formatDate(end(prop("Date Range")), "MMM DD, YYYY") == formatDate(now(), "MMM DD, YYYY")

… or does today land on end of range?

or formatDate(start(prop("Date Range")), "MMM DD, YYYY") == formatDate(now(), "MMM DD, YYYY")

… or is there more than 0 days between now and start of range AND is there less than 0 days between now and end of range? In other words, does date land within range?

dateBetween(now(), start(prop("Date Range")), "days") > 0 and dateBetween(now(), end(prop("Date Range")), "days") < 0

View Example In Notion