Enable or disable based on date

The main thing is to get the Monday of the current week.
How I would do it:

Add two custom properties to the Calendar component
image

Expression for currentMonday

addDays(midnight(now(0)), (2-getDayOfWeek(now(0))))

Expression for daysBetween

daysBetween({Root Container.Calendar.currentMonday}, midnight({Root Container.Calendar.date}))

Expression for Button Enable:

{Root Container.Calendar.daysBetween} >= 0 &&
{Root Container.Calendar.daysBetween} < 14

You could get away with incorporating the daysBetween function as part of the button enable, but I like to have a visual of the value.

1 Like