Entries

Result

empty(prop("Date")) ? "No Date" : ((formatDate(prop("Date"), "L") == formatDate(now(), "L")) ? "Today" : ((start(prop("Date")) < now() and end(prop("Date")) > now()) ? (format(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24)) + " days left") : ((end(prop("Date")) < now()) ? (format(abs(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24))) + " days ago") : (format(ceil(dateBetween(prop("Date"), now(), "hours") / 24)) + " days away"))))

empty(prop("Date")) ? "No Date"

If Date is empty, display No Date

: ((formatDate(prop("Date"), "L") == formatDate(now(), "L")) ? "Today"

Otherwise if the localised DD/MM/YYYY format of the start date of Date is the same as the localised DD/MM/YYYY format of the current date, display Today

: ((start(prop("Date")) < now() and end(prop("Date")) > now()) ? (format(dateBetween(end(prop("Date")), now(), "days")) + " days left")

Otherwise if the start date of Date is less than the current date and the end date of Date is greater than the current date, display the number of days between the current date and the end date of Date, then add days left

: ((end(prop("Date")) < now()) ? (format(abs(dateBetween(end(prop("Date")), now(), "days"))) + " days ago")

Otherwise if the end date of Date is less than the current date, display the number of days between the current date and the end date of Date, then add days ago

: (format(ceil(dateBetween(prop("Date"), now(), "hours") / 24)) + " days away"))))

Otherwise display the rounded up number of days between the current date and the start date of Date, then add days away

Pluralised

empty(prop("Date")) ? "No Date" : ((formatDate(prop("Date"), "L") == formatDate(now(), "L")) ? "Today" : ((start(prop("Date")) < now() and end(prop("Date")) > now()) ? (format(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24)) + " day" + ((dateBetween(end(prop("Date")), now(), "days") > 1) ? "s" : "") + " left") : ((end(prop("Date")) < now()) ? (format(abs(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24))) + " day" + ((dateBetween(end(prop("Date")), now(), "days") < -1) ? "s" : "") + " ago") : (format(ceil(dateBetween(prop("Date"), now(), "hours") / 24)) + " day" + ((dateBetween(prop("Date"), now(), "days") > 1) ? "s" : "") + " away"))))

Commas

<aside> 🔥 Regex with any \\ will fail upon subsequent saves as a second \\ is added. In the formula below the two \\d in each pattern will become \\\\d. Removing the second \\ from each of the six \\\\d will make the formula work again.

</aside>

<aside> 🔥 This also seems to cause the numbers to disappear on Safari. Your mileage may vary.

</aside>

empty(prop("Date")) ? "No Date" : ((formatDate(prop("Date"), "L") == formatDate(now(), "L")) ? "Today" : ((start(prop("Date")) < now() and end(prop("Date")) > now()) ? (format(replaceAll(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24), "(?<=\\d)(?=(\\d{3})+$)", ",")) + " day" + ((dateBetween(end(prop("Date")), now(), "days") > 1) ? "s" : "") + " left") : ((end(prop("Date")) < now()) ? (format(replaceAll(abs(ceil(dateBetween(end(prop("Date")), now(), "hours") / 24)), "(?<=\\d)(?=(\\d{3})+$)", ",")) + " day" + ((dateBetween(end(prop("Date")), now(), "days") < -1) ? "s" : "") + " ago") : (format(replaceAll(ceil(dateBetween(prop("Date"), now(), "hours") / 24), "(?<=\\d)(?=(\\d{3})+$)", ",")) + " day" + ((dateBetween(prop("Date"), now(), "days") > 1) ? "s" : "") + " away"))))

<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1649d2f9-1b45-478a-86b4-341fbe27e06f/benny.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1649d2f9-1b45-478a-86b4-341fbe27e06f/benny.png" width="40px" /> By Ben • Latest • Was this helpful? Please consider buying me a coffee. Cheers!

</aside>