html - 时刻未设置为时间类型
问题描述
这个问题很奇怪,因为它只发生在国外的用户身上,尽管他们像我一样使用 chrome,而在我的国家(以色列)我没有遇到这个问题。
我正在使用 Angular 2。我为 FormControl 分配时间并将 formControlName 绑定到 type="time"。时间没有设置,我得到一个空字段。
问题: 1. 我怎样才能重现它?考虑到它不会在我国复制。2.如果有人能指出问题,那就太好了。
<div (click)="startTimeInput.click()" class="time-div">
<mat-form-field fxFlex class="time">
<input matInput type="time" (TimeChanged)="changeTime($event)" #startTimeInput placeholder="{{'START TIME' | translate}}" formControlName="startTime" required>
</mat-form-field>
<mat-icon class="time-picker-button">access_time</mat-icon>
</div>
zone.run(() => {
if (this.unpack(this.data)) {
this.ShiftForm = new FormGroup({
role: new FormControl(this.role ? this.role : this.settings ? this.settings.role : this.roleNames[1], Validators.required),
capacity: new FormControl(this.capacity ? this.capacity : this.settings ? this.settings.capacity : 1, [Validators.required, Validators.pattern(/[0-9]/)]),
startDate: new FormControl(moment(this.startDate).format('YYYY-MM-DD'), [Validators.required, Validators.pattern(/[0-9]/)]),
startTime: new FormControl(this.startTime, Validators.required),
endDate: new FormControl(moment(this.endDate).format('YYYY-MM-DD'), [Validators.required, Validators.pattern(/[0-9]/)]),
endTime: new FormControl(this.endTime, Validators.required),
labels: new FormControl(this.labels ? this.labels : this.settings ? this.settings.labels : []),
forceAssign: new FormControl(this.forceAssignees ? this.forceAssignees : this.membersListedInShift ? this.membersListedInShift : [])
});
}
});
}
实际:时间是空的
预期:时间已定
解决方案
推荐阅读
- google-calendar-api - Google Calendar .ics 导入问题
- design-patterns - 示例复合设计模式 - 系谱树
- angular - 我的主题在 Angular 中无法正常工作
- c# - 如何将配置文件加载到自动生成的设置类对象中
- excel - VBA 代码返回 if 语句的编译错误
- import - 如何从 src 子文件夹中的文件导入?
- python - Stripe ID 保存到 Django AbstractUser 表中的新行
- r - 如何使用 R 而不是整个数据表更改 excel 文件中的单个条目?
- amazon-ec2 - AWS 防火墙首选项
- sql-server - 使用特殊字符检查字符串是否有效