Skip to content
Date Controls
Share
Explore

icon picker
How to work with Dates

In at least half of the Coda docs I make I find myself needing to quickly access the dates in the current month, current week, last month, last week, etc.

I’ve developed a system that really works for me and makes working with dates in Coda much easier.

How to do it

Creating thisWeek formula

Create a new page in your Coda Doc and call it “Date Controls” (as an example) →
On the Canvas itself, press the = to open up the formula editor and copy and paste the following formula
WithName(datestartof(Today(),"week"),WeekStart ,Sequence(WeekStart,WeekStart+6 ) ).FormulaMap(CurrentValue.ToDate())
3. Lastly, name your formula thisWeek so it can be referenced anywhere in your document
This will output a list of the 7 dates in the current week

Creating lastWeek or nextWeek formulas

On the same page, press the = again to open the formula editor and write the following formulas
For lastWeek:
ThisWeek.FormulaMap(CurrentValue-7)
For nextWeek:
ThisWeek.FormulaMap(CurrentValue+7)

Create thisMonth formula

On your “Date Controls” page follow the same steps as you did to create your thisWeek formula but write out the following formula to access all the dates in the following month
Sequence(datestartof(Today(), "month"), EndOfMonth(Today(), 0)).FormulaMap(CurrentValue.ToDate())
Create lastMonth and thisMonth
For lastMonth:
Sequence(datestartof(EndOfMonth(Today(),-1 ),"month"), EndOfMonth(Today(),-1 )).FormulaMap(CurrentValue.ToDate())
For nextMonth:
Sequence(datestartof(EndOfMonth(Today(),1 ),"month"), EndOfMonth(Today(),1 )).FormulaMap(CurrentValue.ToDate())
There you go! You now have the 6 formulas which can be accessed anywhere in your document for quick filtering, automations, etc. Just make sure you name each formula in the opened formula so that you can access them in your document!
Read on to see an example use case

Example Use Cases

Let’s say you are building a project management document where each project has associated tasks with a targeted start date. It might be natural to have a couple different views of each projects tasks.
You may want to create a view looking ahead to see what specific tasks you have in the upcoming week.
Currently, Coda provides some helpful filters as seen here
image.png
There are some options available — but not extensive
Unfortunately there is no option to choose the next week only the next 7 days. Now that you have your formulas written and referenced in the canvas you can do this:
image.png
Look how easy that is!

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.