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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Date Picker Restrictions
Power Apps
Answered

Date Picker Restrictions

(0) ShareShare
ReportReport
Posted on by 4

I am working in PowerApps on an app that requires users to enter a present or future date in one date picker, and an older date in another date picker. In my testing I have noticed that I started entering the older date in the wrong date picker ( the one that needs a present or future date)

I am thinking an 'If' statement for each datepicker would work, but I'm not sure what terminology to use to identify which dates are incorrect to use.

For the one requiring it could be If(dpAppointmentDate 'is not current or newer date'), Notify("Blocked: A 'Rehire' Scenario requies a Prior Separation Date.", NotificationType.Warning),  (not sure what terminology to code regarding identifying the date restriction),  

Any advice on how to do that? 

Categories:
I have the same question (0)
  • Verified answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
     
    You can compare the selected date with Today() in your If statement.
     
    For the appointment date (must be today or a future date):
    If(dpAppointmentDate.SelectedDate < Today(), 
        Notify("Appointment Date must be today or a future date!", NotificationType.Warning,2000) 
    )
    For the prior separation date (must be in the past):
    If(dpPriorSeparationDate.SelectedDate >= Today(), 
        Notify("Prior Separation Date must be before today!", NotificationType.Warning,2000) 
    )
    or you can put above validation on Submit button first check both date is valid if valid then  only execute the submit form code..
    If(
        dpAppointmentDate.SelectedDate < Today(),
        Notify(
            "Appointment Date must be today or later!",
            NotificationType.Warning,
            2000
        ),
        dpPriorSeparationDate.SelectedDate >= Today(),
        Notify(
            "Prior Separation Date must be before today!",
            NotificationType.Warning, 
            2000
        ),
        SubmitForm(YourFormName)
    )
    Note:
    dpAppointmentDate - Please replace with your control name
    dpAppointmentDate - Please replace with your control name
    YourFormName - Please replace with your control name
     
    ---------------------------------------------------------------------------
    Glad it helped 🙂
    If this fixed your issue,
    please click “Does this answer your question?” to mark it as verified so others can find the solution easily.
    A Like 👍 is always appreciated, and I’m around if you need more help @Kalathiya
  • CJ-26061806-0 Profile Picture
    4 on at
    I had it very close but had forgot to put '.SelectedDate' after dp_NewAppt   I put this in my date picker in dp_NewAppt.OnChange.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard