Custom date selection - possible?

I would like a user to be able to select a date but only want them to be able to select a monday in the past. Is this possible?

One option would be a dropdown with the last 20 mondays in but I would prefer to avoid manually changing a list if possible!

Thanks

mmm, that’s an interesting one.
The Date Picker component does provide an option to only allow dates in the past, but not specific days of the week. However, that doesn’t mean it isn’t possible.

How far back would you want to go? You mentioned the past 20 Mondays - is that it, or could it be any Monday in the past? 1 year ago, 20 years ago?

It wouldn’t be too difficult to dynamically generate the values for a select list based on the current date, using a bit of date math. But that probably wouldn’t be a practical option if there was no limit to how far you could go back.

3 Likes

Probably 6 months is enough so I suppose it would be fairly easy to automate. I am using the native databse rather than sheets. Would you just use Zapier or something to manage that list?

No, I’m pretty sure it can be done with computed columns, no need for anything external.
Give me a little while - I’ll have a fiddle and come back to you with an example.

3 Likes

Okay, here you go. You’ll need a table with two columns, and one row for each week that you want to go back in time. So for 6 months, 26 rows give or take.

  • The first column should be a number column, and fill it with incrementing numbers, beginning at zero
  • The second column should be a math column, using the following formula: Today+2-Weekday(Today)-(Offset*7), where:
    – Today is the special Now value (current date/time)
    – Offset is the value in the first column

Then you can use the math column as the source of a choice component.

Here is how it looks:

4 Likes

Clever - thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.