我有以下json:
[
{
"id": "58b1f024-f9dc-44d3-b07e-9672b5815563",
"userId": "0fdba3ec-90c2-41d7-9912-904f9d0b415d",
"appointment_date": "Tue Oct 20 2020",
"appointment_hour": "10:00 - 11:00",
"created_at": "2020-10-20T21:03:08.285Z",
"updated_at": "2020-10-20T21:03:08.285Z"
},
{
"id": "05591548-dbbe-49dc-a852-e887487bf2a6",
"userId": "ea97c2db-bdb3-4323-a070-91d751aa09b7",
"appointment_date": "Fri Oct 21 2020",
"appointment_hour": "14:00 - 15:00",
"created_at": "2020-10-20T22:08:16.307Z",
"updated_at": "2020-10-20T22:08:16.307Z"
},
{
"id": "5e57942d-33f6-40a8-aae7-bb84fd4c156e",
"userId": "ea97c2db-bdb3-4323-a070-91d751aa09b7",
"appointment_date": "Tue Oct 27 2020",
"appointment_hour": "20:00 - 21:00",
"created_at": "2020-10-20T22:08:17.745Z",
"updated_at": "2020-10-20T22:08:17.745Z"
},
{
"id": "dfc2a605-4e34-4110-8f91-64e618f7c846",
"userId": "0fdba3ec-90c2-41d7-9912-904f9d0b415d",
"appointment_date": "Tue Oct 27 2020",
"appointment_hour": "13:00 - 14:00",
"created_at": "2020-10-20T22:09:33.587Z",
"updated_at": "2020-10-20T22:09:33.587Z"
}
]
我需要在页面上显示此数据,但需要进行动态计算。 例如,如果已通过约会(日期:2020年10月20日,星期二),那么我应该有一行具有“通过的约会标题”,并且该行中的过滤对象具有已通过的日期
<div class="container">
<div class="row" *ngFor='let appointment of json'>
<h1>
Passed appointment
</h1>
<div>
{{ appointment.appointment_date}}
</div>
</div>
</div>
如果是今天的日期,那么另一行中今天的对象。并且如果例如date_date是下周(2020年10月27日,星期二:来自示例)或下个月,则应在另一行显示NEXT WEEK或NEXT MONTH。所有这些如何动态地实现?