Super nube here who is switching from Airtable to Knack. I am in need of some help for our course registration process. We register our students for Tuesday start dates. Is there a way to either only show Tuesday’s in the date field OR like we did in Airtable, convert the date chosen to the nearest Tuesday? Below is the formula I used to use in Airtable:
Hey @Dan3,
You’re going to need three fields here. The start date, an equation to calculate the start date day of the week, and an equation to calculate the next Tuesday.
Note that if the start date is a Tuesday, it will return the same day (e.g. start date = 19 Sep, then nearest Tuesday = 19 Sep).
The Day of week equation field looks like this: getDateDayOfWeek({Start date})
I believe due to the nature of how the Equation field calculates either numerically or date (and not both), merging the two equation fields into one won’t work properly, so avoid trying the below: getDateDayOfWeek({Start date})<=3 ? {Start date}+3-getDateDayOfWeek({Start date}) : {Start date}+10-getDateDayOfWeek({Start date})
This is great I never knew that you use a ternary statement in an equation field. This will remove the need for quite a few JavaScript functions.
Also this specific answer will solve something we have been trying to figure out for a while which is finding out if something has happened before the following weeks friday of the previous date it happened on.
Yep! You can read more about it here.
Unfortunately ternary operators are only bound to numerical values, and don’t work when trying to assess if a field is blank or equals certain text.
It would be a gamechanger if they were in text formulas too.