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 / Leave request to allow...
Power Apps
Answered

Leave request to allow Date Picker to pick up old dates

(0) ShareShare
ReportReport
Posted on by 11

I want to change my formula to allow users to pick up old dates from the app, here is the formula I need to change: 

I have a bit of a case I'm working on a leave request on powerapps and I want to allow the users to pick up any dates for, must be old date or future date  it doesn't matter. 

 

I mean under this formula: 

If(LeaveStartDatePicker.SelectedDate > LeaveEndDatePicker.SelectedDate || And(!_editingRequest, LeaveStartDatePicker.SelectedDate < Today()), "Start date must occur on or " & If(LeaveStartDatePicker.SelectedDate > LeaveEndDatePicker.SelectedDate,"before end date", "after today")) 

Categories:
  • Sanshubh Profile Picture
    512 on at

    Hello @Nosisa_ ,

    Does this mean the User can't select a Start date greater than the end date?

    Explain in detail

  • Nosisa_ Profile Picture
    11 on at

    Hi yes the user must be able to make a request from start date that is less than today 

  • Verified answer
    Sanshubh Profile Picture
    512 on at

    Then write this on a label text property where you want to show the error massage

    If(
     DateTime(
     Year(DateValue2.SelectedDate),
     Month(DateValue2.SelectedDate),
     Day(DateValue2.SelectedDate),
     Value(HourValue2.Selected.Value),
     Value(MinuteValue2.Selected.Value),
     0
     )>=Today(),
     "Please Select Date lessthan Today"
    )

    and this on visible property of label

     

    If(
     DateTime(
     Year(DateValue2.SelectedDate),
     Month(DateValue2.SelectedDate),
     Day(DateValue2.SelectedDate),
     Value(HourValue2.Selected.Value),
     Value(MinuteValue2.Selected.Value),
     0
     )>=Today(),
     true,
     false
    )

     

    this is the start date where I wrote code

    SanshubhLubal_0-1675404917821.png

     

  • Nosisa_ Profile Picture
    11 on at

    DateDiff(LeaveStartDatePicker.SelectedDate,LeaveEndDatePicker.SelectedDate,TimeUnit.Days)+1. This is the solution I ended up doing and works perfectly and also your solution did works. Thanks 

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard