Validation on Date Controls to get Current and Future Dates only in Canvas App

Validation on Date controls to get current and future dates only in Canvas app.

High level resolution steps

    • I have added “Date Selection” label and ”DatePicker” that will show the current date and future
      date.

    Detailed resolution steps

    Step 1: Added all the label and date picker field which is required to show the date as shown in the
    below image.

      Step 2: Now in show the current date in the “DatePicker1” in DefaultDate property use the code as
      shown below:

      
      DefaultDate property of DatePicker1
      Today()
      
          

      Step 3: Now in OnChange property of “DatePicker1” add the below code

      
      If(
          DatePicker1.SelectedDate < Today(),
          Reset(DatePicker1); 
          Notify("You have to select today's date or further dates", 
      NotificationType.Error) 
      )
      
          

      Output

      When I enter the previous date, it will give the error as “You have to select today's date
      or further dates” and reset the value to current date.

      You will be allowed to select only current date and future date.