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 / Continue only when dat...
Power Apps
Answered

Continue only when date is coming

(0) ShareShare
ReportReport
Posted on by 22

Hello,

 

How can I restrict the calendar date selection to be for coming days only not today or before today

 

The code I have as following

Set(
selectedDate,
Calendar_1.StartDate
);
Set(
startTime,
DateTimeValue(
Text(
selectedDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeFrom_1.Selected.Value)
)
);
Set(
endTime,
DateTimeValue(
Text(
selectedDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeTo_1.Selected.Value)
)
);
Navigate(DeskSelect);

 

 

Capture.PNG
Categories:
  • eka24 Profile Picture
    20,925 on at

    Consider this formula on the DisplayMode of the Continue button:

    If(DatePicker1.SelectedDate>Today(),DisplayMode.Edit,DisplayMode.Disabled)
     
    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
  • rsamir Profile Picture
    22 on at

    Do you mean as following? button not working with me

     

    If (DatePicker1 .SelectedDate> Today (),DisplayMode.Edit,DisplayMode.Disabled),
    Set(selectedDate,Calendar_1.StartDate);Set(startTime,DateTimeValue(Text(selectedDate,DateTimeFormat.ShortDate)&" "&TimeValue(ddTimeFrom_1.Selected.Value)));Set(endTime,DateTimeValue(Text(selectedDate,DateTimeFormat.ShortDate)&" "&TimeValue(ddTimeTo_1.Selected.Value)));Navigate(DeskSelect);

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi@rsamir,

    Do you want to force the Calendar_1 not to selected today or before today?

    Based on the formula you provided, the answer is no, you could not put the If statement into the OnSelect property of a Button.

    The If statement is for the DisplayMode property of the continue button.

    You could try to set the OnSelect property of the Calendar_1 as below:

    If(Calendar_1 .SelectedDate<=Today(),Notify("Please select a date that for coming days only not today or before today!",NotificationType.Error),Notify("Successfully select!",NotificationType.Success))

    Regards,

    Qi

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 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard