首页 > 解决方案 > 有没有办法将系统日期与 Angular TypeScript 中的日期列进行比较

问题描述

我在尝试将日期列值与系统日期进行比较时遇到问题。下面是代码。

public top5Items: Goal[] = [];
  top5DailyItems() {
    var date: Date = new Date();
    this.apiservice.GetAllItems().subscribe(res => {
      this.allGoals = res;
      this.top5Items = this.allItems.filter(x => x.completion == 'Completed' && x.updatedDate.getDate == date.getDate());
    });
  }


<tr class="table-default" *ngFor="let top5DI of top5Items">

它在 lambda 表达式部分通过错误“TS2367:This condition will always return false ....”

标签: typescriptdatetimeangular8

解决方案


推荐阅读