How to enable only specific dates in Angular 5?

后端 未结 2 635
执念已碎
执念已碎 2021-01-25 05:48

I have set of dates and I want to enable only those dates in .

\"ListOfDates\": [
      {
         \"startDate\": \"2018-01-01         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-25 05:51

    myFilter = (d: Date): boolean => {
      let enableFlag = false;
      this.ListOfDates.some((date) => {
        if (date.startDate === d) { // You can use any other comparison operator used by date object
          enableFlag = true;
          return true;
        }
      })
      return enableFlag;
    }
    

    Note: You will have to format the d and dates in ListOfDates to a standard format of your choice

提交回复
热议问题