Red Gregory

View Original

Notion Formula: Does Date Range Contain Today?

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