Skip to main content

Notifications

Community site session details

Community site session details

Session Id : XoSvO27KRh1Lffqw/Ac0Cy
Power Apps - Power Apps Pro Dev & ISV
Suggested answer

DatePicker with Minimum and Maximum date ranges

Like (1) ShareShare
ReportReport
Posted on 9 Sep 2024 02:43:18 by 384
Hi,
 
Is it possible to set max and min date ranges to select for date picker? Remaining dates should be greyed out. 
There are no MaxDate and MinDate properties for date picker control in PowerApps. Is there any other way to achieve this? Any suggestion would be greatly appreciated.
 
Thank you,
 
  • OK29 Profile Picture
    384 on 12 Sep 2024 at 11:52:19
    DatePicker with Minimum and Maximum date ranges
    @FLMike, Thank you for your comments. I tried but I am getting error message that "A property cannot reference itself or other properties effected by its value" once I enter the below function in defaultdate property.
     
    This date picker is in a data control.
     
    Did you try this at your end?
  • Ravindra Jadhav Profile Picture
    263 Super User 2025 Season 1 on 09 Sep 2024 at 06:29:26
    DatePicker with Minimum and Maximum date ranges
    Thanks @Flmike
     
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    41,002 Super User 2025 Season 1 on 09 Sep 2024 at 04:32:55
    DatePicker with Minimum and Maximum date ranges
    Hi,
     
    Yes, you can change the DefaultDate Property so that it doesn't allow you to do that.
     
    Example
     
    Let's pretend you do not want to go backwards more then 10 days and Forward more than 10 days from Today.
     
    You need to have "something" store the DefaultDate which acts as your starting point.
    So an Example
     
    In my OnVisible of the Screen, where this control exists I do this
     
    Set(_DefaultDate, Now());
     
    This will simply allow us to understand the initial date to subtract and add days too, too see if they are too far before or after the dates you want.
     
    In your DefaultDate Property of the DatePicker we need to do this
     
    If( DateDiff(Self.SelectedDate, _DefaultDate,TimeUnit.Days) > 10 days Or DateDiff(YourDate, Self.SelectedDate, TimeUnit.Days) > 10,
       _DefaultDate,
    );
     
    What the above does is, it checks to see if whatever date they picked is greater than 10 days in either direction.
    and if so resets it to the _DefaultDate from the Variable you create. If it is NOT greater than 10 then it lets them keep what they selected
     
    You can certainly create Environment Variables or some sharepoint config list, to store the Number, this way you can change it whenever.
          
    Cheers,
     
     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,641 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard