By Alex Sherwood aka aNotioneer

<aside> 👋 This guide shows you how to translate a date e.g. a due date, into relative timeframes based on calendar weeks like "last week", "this week", "next week".

I find this is really useful for quickly getting a sense of how long I have left to complete a task, as we generally review our tasks on a weekly basis in my company.

The date format in this guide considers Sunday as the start of the week. To use Monday as the start of the week instead, change the lowercase "w" to an uppercase "W".

Let me know if you have any questions / feedback here.

</aside>

📸 Examples

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c204149d-3cb6-443d-aee4-8e6498ea2fd2/Screenshot_2019-09-01_at_15.51.51.png

👨‍🏫 Guide

<aside> 🚨 If you get an error message about a ‘syntax error’ when copying and pasting these formulas, try copying the ‘Unformatted formula’ from the toggle list instead.

</aside>

Managing dates in different years

Your formula needs to check for dates that're in different years before it takes care of dates in the same year.

If the date is last year

if(year(prop("Due")) < year(now()), "Overdue","")

If the date is next year

This formula does not allow for dates that're 2+ years away but it can easily be adapted to do so, if you need it to.

**if(year(prop("Due")) > year(now()),** if(toNumber(formatDate(prop("Due"), "w")) == toNumber(formatDate(now(), "w")), "This week", if(toNumber(formatDate(prop("Due"), "w")) + 52 - toNumber(formatDate(now(), "w")) == 1, "Next week", if(toNumber(formatDate(prop("Due"), "w")) + 52 - toNumber(formatDate(now(), "w")) == 2, "2 weeks", if(toNumber(formatDate(prop("Due"), "w")) + 52 - toNumber(formatDate(now(), "w")) == 3, "3 weeks", if(toNumber(formatDate(prop("Due"), "w")) + 52 - toNumber(formatDate(now(), "w")) == 4, "4 weeks", if(toNumber(formatDate(prop("Due"), "w")) + 52 - toNumber(formatDate(now(), "w")) >= 5, "Later", "")))))) **,"")**