输入日期类型在 safari 中不起作用 angular 的任何替代方法?

Input with type date dont work in safari any alternative for angular?

我做了一些研究,发现 safari 不支持 type="date" 的替代日期,使用 jquery 显然使其工作或日期选择器以某种方式在 [=23] 中执行此操作=] 以更自然的方式?

我的输入

<input
    [ngModelOptions]="{ standalone: true }"
    [ngModel]="user.expirationDate | date:'yyyy-MM-dd'"
    (ngModelChange)="user.expirationDate = $event"
    (blur)="save()"
    type="date"
    class="form-control"
/>

替代工作 Jquery

<input type="date" id="test" />

Js

if ( $('#test')[0].type != 'date' ) $('#test').datepicker();

jQuery UI 日期选择器已过时,最终在 Safari 上也会出现严重的 UI 问题。 (我最终通过添加笨拙的文本缩进技巧来解决这个问题) 我会推荐 Angular material datepicker https://material.angular.io/components/datepicker/overview