web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Datepicker Powerapps r...
Power Apps
Unanswered

Datepicker Powerapps restrict selecting past days

(0) ShareShare
ReportReport
Posted on by 31

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.

Categories:
I have the same question (0)
  • Bilakanti Profile Picture
    1,226 on at

    @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.

  • SteveAtTCH Profile Picture
    54 on at

    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)
    )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard