一个简单的问题:如何显示具有今天日期的记录列表? 我的HTML:
<table class='table hovertable'>
<tbody class="mytable">
<tr *ngFor="let timeRecord of timeRecords">
<th>
{{timeRecord.date | date:'dd.\u00A0'}}{{timeRecord.date | date:'MMMM' | convertToSlovakMonthsPipe}}
</th>
<td>
{{timeRecord.duration}} h
</td>
<td>
{{timeRecord.allocation}}
</td>
<td>
{{timeRecord.comment}}
</td>
</tr>
</tbody>
</table>
和获取所有记录的打字稿:
getTimeRecords() {
this.timeRecordService.getTimeRecords()
.subscribe(
(time: ITimeRecord[]) => {
this.timeRecords = time;
}
)
}
答案 0 :(得分:0)
this.timeRecords = time.filter(t => t.getTime() == Date.now().getTime() );