How to restrict user from selecting future dates for DOB field validation?

Angular- DOB Date field

how to restrict user from selecting future dates for Date Of Birth field validation?

There are many ways to achieve this requirement to restrict user from selecting future dates:

  • Simple use input type date with minimum and maximum date see the Mozilla developer network
  • Create a variable assigning today’s date and bind it to the input “max” attribute…
  • Use custom pipe

or refer below code snippet for basic javascript for datetimepicker :

DatePickerxx.BorderColor: If(DatePickerxx.SelectedDate > Today(), Color.Red, RGBA(101, 128, 187, 1))
Labelx.Text: “Dates in the future cannot be selected”
Labelx.Color: Color.Red
Labelx.Visible: DatePickerxx.SelectedDate > Today()

 

 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *