How disable all the dates before a particular date in angular?

前端 未结 6 1565
别跟我提以往
别跟我提以往 2021-02-07 20:15

I am building a component (html, css, spec.ts, ts) in angular in which I always want endDate > startDate. I have followed this link https://material.angular.io/components/datepi

6条回答
  •  失恋的感觉
    2021-02-07 20:59

    Unless I'm missing something, you can use the [min]="" date property:

    Whatever startDate is will limit the Calendar dates available for endDate. If you need it set before startDate is chosen, use another variable and set it in consturctor() or ngOnInit() of your component.

    See: https://material.angular.io/components/datepicker/overview#date-validation

提交回复
热议问题