cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yoursnani
Post Patron
Post Patron

Date Field selectable +2days on the day

Hi,

I am new to power apps . I am customizing SharePoint . my query is 

I have a date field and I want to make user only choose the date from +2 days . 

Example : I have open for on 18/06/2021 . when I open date picker the date should one 20/06/2021 or plus date can selectable . previous and next two days can't be selectable . 

Please help me 

 

Thank you 

2 ACCEPTED SOLUTIONS

Accepted Solutions
zmansuri
Super User
Super User

Currently there is no option to show limited date in date control. What you can do is set a label below date picker and write this code in Visible property of label. That way if user select any thing that's not in +/- 2 range it will display this error label.

 

DatePicker2.SelectedDate >= DateAdd(Today(),3,Days) || DatePicker2.SelectedDate <= DateAdd(Today(),-3,Days)

 

a17.jpg

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

View solution in original post

Please select Accept as Solution if i have solved your problem. You can click thumbs up if you like my response.

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

View solution in original post

5 REPLIES 5
zmansuri
Super User
Super User

Currently there is no option to show limited date in date control. What you can do is set a label below date picker and write this code in Visible property of label. That way if user select any thing that's not in +/- 2 range it will display this error label.

 

DatePicker2.SelectedDate >= DateAdd(Today(),3,Days) || DatePicker2.SelectedDate <= DateAdd(Today(),-3,Days)

 

a17.jpg

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

@zmansuri 

 

Thank you 

Please select Accept as Solution if i have solved your problem. You can click thumbs up if you like my response.

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

nickellis74
Resolver II
Resolver II

I would be tempted to use a dropdown control rather than a calendar here. Insert a dropdown control and set the Items property to: 

[DateAdd(Today(),-2),DateAdd(Today(),-1),Today(),DateAdd(Today(),1),DateAdd(Today(),2)]

Then set the Default to Today()

nickellis74_0-1624029895225.png

You'll get a dropdown that looks like this:

nickellis74_1-1624029939304.png

I hope that helps!


Nick

@nickellis74 

Thank you for responding 

It's working fine. but I am using this in edit page . when I am submitting form everything's .it will changing first date. I don't want like . that . I want only one time selectable 

 

Can we do that

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,549)