cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Alert user when selecting date out of range

Good Day PA Community,

 

I am trying to find a way that I can set a variable to alert a user when they have selected a date that is outside of the current month.

For example, I have a date picker, and today is 9/18/2020.  As a user, if I select a date that is before 9/01/2020 or after 9/30/2020, I should receive a pop-up notification to confirm my selection.

 

Is it possible to calculate the days in the month and determine if the selected date is within the current month?  Any insight would be great.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Alert user when selecting date out of range

@Kgray15 

You could use pop ups and such, but you might also just consider a simple label with and error message and then set the visibility of the label to:

   !(Text(yourDatePicker.SelectedDate, "yyyymm") = Text(Now(), "yyyymm"))

 

This label will then become visible when they selected a month not equal to the current month (and year).

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Alert user when selecting date out of range

@Kgray15 

You could use pop ups and such, but you might also just consider a simple label with and error message and then set the visibility of the label to:

   !(Text(yourDatePicker.SelectedDate, "yyyymm") = Text(Now(), "yyyymm"))

 

This label will then become visible when they selected a month not equal to the current month (and year).

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Frequent Visitor

Re: Alert user when selecting date out of range

@RandyHayes ,

You're a genius.  This worked beautifully.  I've been trying much more complicated ways to handle this by trying to calculate days from today and such as seen below to no avail.

DateAdd(Today(),1-Weekday(Today(),2),Days 

 

Funny how you can so easily overcomplicate things that would actually be rather simple.  Thank you for the help!

Highlighted
Super User III
Super User III

Re: Alert user when selecting date out of range

@Kgray15 

Yes...always think simple with PowerApps.  It will save you tons of grief!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,111)