cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KathrynHughes
Helper I
Helper I

DatePicker modification and dropdown filtering for a custom list of items.

Hi,

 

I am creating a vehicle booking app.

I have a select start date and select end date both using DatePicker - is there a way to implement coding so that once the first date is selected the second datepicker will not allow an earlier date to be selected?

 

Also

I have a dropdown for start time and a dropdown for end time - can anyone advise the best way to have this work so that. If the StartDate = EndDate then the drop downs will filter so that for the end time an earlier time will not be shown?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hey!
 
Currently powerapps doesnot support restricting the dates, maybe this feature will be added in near future. You can only restrict StartYear and EndYear.
 
Instead what you can do is display an error message whenever the end date is less than start date. Also, you can disable the submit button when the error is displayed.
 
Please modify the Visible property of Error Text:
If(DatePicker2.SelectedDate < DatePicker3.SelectedDate && !IsBlank(DatePicker2.SelectedDate) && !IsBlank(DatePicker3.SelectedDate),true,false)
 
Here, DatePicker2 refers to EndDate and DatePicker3 refers to StartDate
 
Also, modify the DisplayMode property of Submit button as:
If(DatePicker2.SelectedDate < DatePicker3.SelectedDate && !IsBlank(DatePicker2.SelectedDate) && !IsBlank(DatePicker3.SelectedDate),Disabled,Edit)
 
Can you please share the items inside your start Time and End Time dropdown, so that we can assist you better.
 
Thanks, 
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2

Hey!
 
Currently powerapps doesnot support restricting the dates, maybe this feature will be added in near future. You can only restrict StartYear and EndYear.
 
Instead what you can do is display an error message whenever the end date is less than start date. Also, you can disable the submit button when the error is displayed.
 
Please modify the Visible property of Error Text:
If(DatePicker2.SelectedDate < DatePicker3.SelectedDate && !IsBlank(DatePicker2.SelectedDate) && !IsBlank(DatePicker3.SelectedDate),true,false)
 
Here, DatePicker2 refers to EndDate and DatePicker3 refers to StartDate
 
Also, modify the DisplayMode property of Submit button as:
If(DatePicker2.SelectedDate < DatePicker3.SelectedDate && !IsBlank(DatePicker2.SelectedDate) && !IsBlank(DatePicker3.SelectedDate),Disabled,Edit)
 
Can you please share the items inside your start Time and End Time dropdown, so that we can assist you better.
 
Thanks, 
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks for your response! I have built my own calendar following:

 

https://blogs.msdn.microsoft.com/davidni/2016/12/13/building-an-interactive-calendar-view-with-power...

 

Which allows me to be more flexible than using the DatePicker and I have disabled the start button when the conditions I do not like are present - this gives my app the functionality it needs!

 

Thanks

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (5,170)