【发布时间】:2019-10-06 09:58:25
【问题描述】:
我在我的反应形式和 Firestore 中使用 Angular Material 来存储日期和时间。由于 Angular Material 只有 Datepicker (https://material.angular.io/components/datepicker/overview) 而没有 Timepicker,所以我在另一个领域工作了时间,也就是说,我有两个领域。
但是当我想按日期和时间过滤数据时,这会给我带来其他问题。
我的问题是,如何将日期和时间放入并存储在单个 firestore 字段中?
目前这是我所拥有的:
components.ts
this.forma = fb.group ({
fechaInicio: [ '', Validators.required ],
horaInicio: [ '', Validators.required ],
});
components.html
<div class="row">
<mat-form-field class="col-lg-7 col-6" appearance="outline">
<mat-label>Fecha inicio</mat-label>
<input matInput [matDatepicker]="picker" placeholder="Fecha inicio" formControlName="fechaInicio">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker touchUi #picker></mat-datepicker>
</mat-form-field>
<mat-form-field class="col-lg-5 col-6" appearance="outline">
<mat-label>Hora inicio</mat-label>
<mat-select placeholder="Hora inicio" formControlName="horaInicio">
<mat-option *ngFor="let hora of horas" [value]="hora">
{{ hora }} hrs.
</mat-option>
</mat-select>
</mat-form-field>
</div>
【问题讨论】:
标签: angular google-cloud-firestore