How do I calculate an event date for the next monday? (forms)

Hey there -

I’m trying to create a form that will create an event date that will always jump to the next Monday no matter when the user creates the form.

e.g. If I open the form on tuesday it should set the initial date to 6 days from then. If I open the form on Saturday it should set the initial date to 2 days from then.

Is there a way to know the day of the week in a date?

I feel like something similar to this recommendation as Karimoo in the link below could work, but am unclear. Help : StarTIME +60 = funny Endtime 🤔

Thanks!

1 Like

Hey @MisterPass, from what you mentioned, it sounds like Zapier could help with setting the date.

Whenever a new record is added to the Events collection, it’d set a date on the coming Monday.

The user should never be able to set which Monday it is.

But if you do want the user to choose which Monday (eg. next Mon, following Mon, the Mon after the following, etc.), then I think you could have a dropdown with a few options like that.

Then you’d have to configure Zapier to conditionally set the date based on the choice.

Hope that makes sense!

Thanks for the reply!

I was hoping to stay within Adalo for this one since I haven’t had a need to go outside yet, but that idea sounds reasonable.

Ultimately, I’m going to be using this initial Monday date to create the next week’s worth of events that the user will be able to adjust based on their availability. So I was hoping to find the Monday then add 1 day for tuesday, 2 for wednesday, etc…

I feel like I should be able to calculate it within the date field in a similar way to the article I linked, but I haven’t been able to figure out the calculation yet. I’ve done something similar a LONG time ago within SQL. Maybe I’ll go check out stack overflow for that calculation.

Calculation sounds like a scalable way to do it, but I think the initial set up will take some time, unless you have a background in SQL and formulas, I guess :joy: Good luck!

1 Like

Figured it out… How to derive weekdays from a date This thread gave me the formula and I slightly modified it to this and it worked…

image

3 Likes

Great formula for the solution, thanks for posting that for others to benefit from @MisterPass

1 Like

thanks, @Colin

Do you happen to know a way to use this same formula in other components but to format it as a date?

For example, I’m wanting to show this same “next monday” date across my UI, even when the user doesn’t have an event set up for that date.

So far I have only been able to get a unix date (18526.166666666668 = 9/21/2020) but can’t format that as a date.

image

It seems like I need to be able to either update a date picker with magic text/custom formula OR be able to format a calculated field as a date.

I haven’t been able to find a way to do this yet though…

1 Like

We are working on some help documentation in regards to dates and times. I have added this use case to the list that we will cover in the document.

1 Like

Great! Thanks for the reply. I look forward to seeing the documentation

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