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

Date no less than today

I've built and app - using SharePoint lists. I have a date field which on selection shows a calendar graphic, below from which teh date can be selected.

Big_Blue_Bear_0-1659016518047.png

I want to add a control to this data card, which doesn't allow past dates to be selected. 

 

Any suggestions would be much appreciated

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Super User
Super User

@Big_Blue_Bear Please try the following,

Set the DefaultDate property of the DatePicker control to Today()

 

Set the OnChange property of the DatePicker control to,

If(yourDatePicker.SelectedDate<Today(), UpdateContext({varResetDatePicker: true}); UpdateContext({varResetDatePicker: false}))

 

Set the Reset property of the DatePicker control to varResetDatePicker

 

Please remember to give a 👍 and accept my solution as it will help others in the future.

View solution in original post

2 REPLIES 2
CNT
Super User
Super User

@Big_Blue_Bear Please try the following,

Set the DefaultDate property of the DatePicker control to Today()

 

Set the OnChange property of the DatePicker control to,

If(yourDatePicker.SelectedDate<Today(), UpdateContext({varResetDatePicker: true}); UpdateContext({varResetDatePicker: false}))

 

Set the Reset property of the DatePicker control to varResetDatePicker

 

Please remember to give a 👍 and accept my solution as it will help others in the future.

BCBuizer
Super User
Super User

Hi @Big_Blue_Bear ,

 

Please change the OnSelect property of the Title label in the MonthDayGallery to:

 

 

With(
    {
        _clickedDate: DateAdd(
            _firstDayInView,
            ThisItem.Value,
            Days
        )
    },
    If(
        _clickedDate+1 > Now(),
        Set(
            _dateSelected,
            _clickedDate
        )
    )
)

 

 

 

 

Edit: This solution works if you are using the Calendar screen template. For the standard DatePicker control, please use @CNT 's solution.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

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 (3,857)