How to use Text to set weekdays | Is not working as expected

I want to display events ( Lessons) in the Calendar View

For each event I need
Lesson Name
START TIME and DATE
END TIME and DATE

I make the USER to push to a DATE TYPE column, the name of the WEEKDAY, so the system Sets the Date. Then I can concatenate the info as I needed.

I was using

FRIDAY, NEXT FRIDAY
SATURDAY, NEXT SATURDAY
ECT, NEXT ECT

BUT…the behaviour of how the system sets the dates is not as expected.

Example:

When I get to Monday the system doesn’t refer MONDAY to THIS WEEK MONDAY, it refers both values to NEXT MONDAY.

I don’t need to stick to this method, I’m trying to have the dates from TODAY, TOMORROW , ect + 7 days and know which one is which WEEKDAY

So i can show in the calendar view a recurrent lesson. Lesson 1 This week monday and next week monday, Lesson 2 This week and next week and so on…

Thanks and Regards,

Daniel

Yes, I believe it will choose the nearest date if you don’t specify NEXT, THIS, etc. This is more of a pleasant side effect of java than it is an actual feature. In reality, it’s trying to guess the date that you meant, but how you interpret it and how the code interests it might be different.

A lot of it is largely discussed in this thread.

In your case, it maybe interpreting NEXT as Next week. In this case the nearest Monday and the Monday next week is actually the same, whereas Friday and Saturday still occur within this week.

I think you would be better off determining the date mathematically instead of letting glide interpret what it thinks the date should be.

Something like this might work in a Math column to determine Friday’s date of the current week.
now+6-WEEKDAY(now)

Something like this might work to get Friday of next week.
now+6-WEEKDAY(now)+7

For Saturday, you would replace 6 with 7.
For Monday, you would replace 6 with 2.

“Now” is assuming you want to use the current date in the formula. Instead you could use your start or end date as the replacement for Now.

It may not be the correct formula for your use case. I’m just doing this in my head, but hopefully you get the idea of how to mathematically calculate the dates. At least play with it and see if it gets you the dates you want. If not, I can sit down and work out some formulas.

3 Likes

Got Mr Jeff! Thanks again for being here with cool ideas. It all started with that ¨having fun with dates", all this new context on how the system works helps a lot. I’m gonna give it a try with that formular approach.

1 Like