Problem: you want to Filter a Gallery based on data in the current week. You set up two DatePickers to set the start (DatePicker1) and end dates (DatePicker2). However, you want the DefaultDate of DatePicker1 to be the Monday of the current week.
I have a solution for calculating the Monday. Set DatePicker1.DefaultDate to:
DateAdd(Today(),
If(Weekday(Today())=1,-6,
Weekday(Today())=2,0,
Weekday(Today())=3,-1,
Weekday(Today())=4,-2,
Weekday(Today())=5,-3,
Weekday(Today())=6,-4,
Weekday(Today())=7,-5
)
)
This formula subtracts the number of days relative to the last Monday and outputs a date.
If you prefer a Sunday, you just need to change the number to subtract, or you could shift the Weekday formula to another mode.