I am using the PowerApps OOTB Calendar Screen components to select multiple dates/days and i am trying to disable the past/back dates and weekends so users cannot select back dates so far i was able to disable just one day of the week by setting
the Display Mode of Title4/label in the gallery to
If(Weekday(DateAdd(_firstDayInView, ThisItem.Value, Days))=7,DisplayMode.Disabled,DisplayMode.Edit)
& set the Disabled Fill Property to
If(Weekday(DateAdd(_firstDayInView,ThisItem.Value, Days))=7,LightGray)
Need some help with the correct formula to disable (Sunday and past dates)..
Thank you for your time..
Solved! Go to Solution.
DisplayMode property:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
If(
Or(
calendarDate < Today(),
Weekday(calendarDate) in [1,7]
),
Disable,
DisplayMode.Edit
)
)
Fill Property:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
/*Fill value changes if the gallery item day = today, or if it lies outside of the current month*/
If(
calendarDate < Today(),RGBA(200, 200, 200, 0.3),
/*Date selected is today*/
calendarDate = Today() && calendarDate = _dateSelected, RGBA(0,0,0,0),
/*Today when it is not selected*/
calendarDate = Today(), ColorFade(Subcircle1.Fill, 0.67),
/*The day is outside the range of the currently selected month*/
Abs(Self.Text - ThisItem.Value) > 10,RGBA(200, 200, 200, 0.3), RGBA(0, 0, 0, 0)))
You can set DisabledFill back to RGBA(0, 0, 0, 0)
Correction, the Fill property needs to be set to this:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
/*Fill value changes if the gallery item day = today, or if it lies outside of the current month*/
If(
Or(calendarDate < Today(),Weekday(calendarDate) in [1,7]),RGBA(200, 200, 200, 0.3),
/*Date selected is today*/
calendarDate = Today() && calendarDate = _dateSelected, RGBA(0,0,0,0),
/*Today when it is not selected*/
calendarDate = Today(), ColorFade(Subcircle1.Fill, 0.67),
/*The day is outside the range of the currently selected month*/
Abs(Self.Text - ThisItem.Value) > 10,RGBA(200, 200, 200, 0.3), RGBA(0, 0, 0, 0)))
DisplayMode property:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
If(
Or(
calendarDate < Today(),
Weekday(calendarDate) in [1,7]
),
Disable,
DisplayMode.Edit
)
)
Fill Property:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
/*Fill value changes if the gallery item day = today, or if it lies outside of the current month*/
If(
calendarDate < Today(),RGBA(200, 200, 200, 0.3),
/*Date selected is today*/
calendarDate = Today() && calendarDate = _dateSelected, RGBA(0,0,0,0),
/*Today when it is not selected*/
calendarDate = Today(), ColorFade(Subcircle1.Fill, 0.67),
/*The day is outside the range of the currently selected month*/
Abs(Self.Text - ThisItem.Value) > 10,RGBA(200, 200, 200, 0.3), RGBA(0, 0, 0, 0)))
You can set DisabledFill back to RGBA(0, 0, 0, 0)
Correction, the Fill property needs to be set to this:
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
/*Fill value changes if the gallery item day = today, or if it lies outside of the current month*/
If(
Or(calendarDate < Today(),Weekday(calendarDate) in [1,7]),RGBA(200, 200, 200, 0.3),
/*Date selected is today*/
calendarDate = Today() && calendarDate = _dateSelected, RGBA(0,0,0,0),
/*Today when it is not selected*/
calendarDate = Today(), ColorFade(Subcircle1.Fill, 0.67),
/*The day is outside the range of the currently selected month*/
Abs(Self.Text - ThisItem.Value) > 10,RGBA(200, 200, 200, 0.3), RGBA(0, 0, 0, 0)))
@EricBLott The solution works perfect for the background color fill, however the users can still click/select the weekends and past days
i was hoping to disable past days and weekends 😞
@Jean_9681 Even after setting the DisplayMode property of the calendar gallery item to the formula I pasted? It's working on my end.
**I noticed a typo in my formula. Try this one for DisplayMode
With(
{
calendarDate: DateAdd(
_firstDayInView,
ThisItem.Value,
Days
)
},
If(
Or(
calendarDate < Today(),
Weekday(calendarDate) in [1,7]
),
Disabled,
DisplayMode.Edit
)
)
_firstDayInView isn't recognized, can you help me please
User | Count |
---|---|
252 | |
104 | |
94 | |
50 | |
39 |