### Timeline Progress Visual Display

Here is a nice visual way to display progress within a timeline using a formula. Our formula is going to require a few different properties to function:

**prop(“Dates”)**

The “Dates” property has a property type of “Date”, and uses a range (meaning it has both a start date and end date value).

**prop(“Progress Percentage”)**

The “Progress Percentage” property uses a formula that calculates our progress (in a decimal) within the date range, if the current date falls between the start and end dates. This is just a little bit of math, dividing the elapsed number of days by the total number of days in the date range. We also add the round() function just to eliminate long decimal points (for example, 0.52 instead of 0.51951951952…)

`if(now() >= dateStart(prop("Dates")) and now() <= dateEnd(prop("Dates")), round(dateBetween(now(), dateStart(prop("Dates")), "days") / dateBetween(dateEnd(prop("Dates")), dateStart(prop("Dates")), "days") * 100) / 100, if(now() > dateEnd(prop("Dates")), 1, 0))`

**prop(“Weeks Remaining”)**

The “Weeks Remaining” property uses a formula that calculates the number of weeks remaining until we reach the end date.

`dateBetween(dateEnd(prop("Dates")), now(), "weeks")`

Alternatively, use “days” instead of weeks to get the number of days remaining:

`dateBetween(dateEnd(prop("Dates")), now(), "days")`

**prop(“Timeline Display”)**

Once we have our base properties and formulas in place, we can construct our Timeline Display formula. To do this, we use Notion’s `substring()`

function. Substring takes a string of characters and breaks it apart at a designated point. Our string of characters forms the base of our visual timeline:

⋯⋯⋯⋯⋯⋯⋯⋯

We can determine where to break the string apart by using the “Progress Percentage” property (with a multiplier to get a whole number). This represents the amount of time that has passed since the start date. We perform the slice operation again, but this time subtracting the “Progress Percentage” from 1 to visually represent the amount of time remaining until the end date. In between the two slice functions we add a symbol 𒑱 that essentially says, “This is today!”

`substring("⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯", 0, round(prop("Progress Percentage") * 10)) + "𒑱" + substring("⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯", 0, round((1 - prop("Progress Percentage")) * 10))`

This works great as is, but if we want to display any additional symbols or text, we can concatenate them together. In our example we are displaying a text display of the start and end dates (in Y MMM format), circle symbols to act like book ends on the visual timeline, and also a text display showing how many weeks are left until the end date (using the “Weeks Remaining” property). We also run an additional check to make sure the “Dates” property is not empty – if so, the timeline bar will not display.

Here is all of it together:

`if(empty(prop("Dates")), "", ((((((formatDate(dateStart(prop("Dates")), "Y MMM") + " ◯") + substring("⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯", 0, round(prop("Progress Percentage") * 10))) + "𒑱") + substring("⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯", 0, round((1 - prop("Progress Percentage")) * 10))) + "◯ ") + formatDate(dateEnd(prop("Dates")), "Y MMM")) + if(prop("Weeks Remaining") < 0, " (0 weeks left)", (" (" + format(prop("Weeks Remaining"))) + " weeks left)"))`

The end result: