我想要上午和下午以及 <input type="time"> 中的时间

I want AM and PM along with time in <input type="time">

这是 HTML 代码。

<mat-form-field appearance="outline">
    <mat-label>Time From: </mat-label>
    <input matInput type="time" formControlName="start_time">
</mat-form-field>

并在表单提交后输出。

{
   start_time: "00:47"
}

您可以使用 moment.js 库来获得带有输入时间的 AM/PM。

moment(start_time,'hh:mm').format('hh:mm a')

使用 date-fns 库中的格式,moment.js 已弃用