Sitemap
recurring item on the same day

Member-only story

How to lock weekdays in a recurring schedule?

Pick the nearest date with the same weekday

4 min readDec 7, 2024

--

Ever noticed how scheduling something “monthly” can be a bit unpredictable? It all comes down to the days of the week. Weeks are neat and tidy — add a week (or two), and you land on the same day you started. But months? They’re a bit more chaotic with their varying lengths.

In my last post, we tackled calculating future dates for recurring tasks. This time, we’ll dive into how to keep those tasks locked to the same day of the week. Why? Because, let’s face it, remembering tasks is way easier when they have a consistent weekly home.

Step 1 — check if we are good to go

First, we’re going to reuse some code we wrote earlier (check out my previous post for the nitty-gritty details). This code generates a list of dates based on your recurrence pattern (like, say, every month for three months).

the code we developed earlier used as our starting point

A few words on the ForEach() you see in the screenshot generating a list of dates. Instead of treating that list as one big blob, we want to look at each date inside it individually. To emphasize this, we give the…

--

--

Christiaan Huizer
Christiaan Huizer

Written by Christiaan Huizer

Until March 2025 I wrote once a week about how to Coda . You find blogs for beginners and experienced makers. Welcome!

No responses yet