Hello,
Is there a way to restrict past days in datepicker. I want after date of 15th every month to disable selecting a date from previous month.
Let's say today is 15th January. I want to not be able to select a date from december, only from January. And when it will be 15th feb, i dont want to select a date from Jan.. and so on.
Can someone help? Thank you.
hi @andrasetof30 ... I'm using the following code to only allow users to select a date from today, out 60 days... in my example below, my calendar is actually part of a gallery (which is why I'm referring to the selected date as ThisItem.Value)... but you can replace that reference with the name of your date picker (datepicker.selecteddate)...
i know this isnt exactly the logic you're looking for, but hopefully this can give you a reference you can adjust for your scenario?
If(
Date(Year(ThisItem.Value), Month(ThisItem.Value), Day(ThisItem.Value)) >= DateValue(Now()) And
Date(Year(ThisItem.Value), Month(ThisItem.Value), Day(ThisItem.Value)) <= DateAdd(Now(), 60, Days),
< acceptable date logic goes here >,
Notify("Only dates between " & DateValue(Now()) & " and " & DateAdd(Now(), 60, Days) & " will be accepted.", NotificationType.Error, 2000)
)
@andrasetof30 Currently canvas app datepicker control doesn't have that restriction, but as a workaround, on your datepicker onchange property you can write a logic to see if the selected date is less than the today, if yes, then notify the user and reset the control.
Else- another option is to develop a custom PCF control and use it.
WarrenBelz
146,780
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional