2 回答
TA贡献1770条经验 获得超3个赞
您可以添加以下工作方式
getDate : any
createForm() {
this.newForm = this.fb.group({
date: this.getDate;
});
ngOnInit(){
const today = new Date();
const SelectedDate = `${today.getFullYear()}-${today.getMonth() + 1}-${today .getDate()}`;
this.getDate = new Date(SelectedDate);
this.createForm();
}
TA贡献1853条经验 获得超9个赞
您可以使用此代码:
let startDate = new Date(this.yourForm.value.startDate);
let endDate = new Date(this.yourForm.value.endDate);
let startTime = this.yourForm.value.startTime.split(":");
let endTime = this.yourForm.value.endTime.split(":");
startDate.setHours(startTime[0]);
startDate.setMinutes(startTime[1]);
endDate.setHours(endTime[0]);
endDate.setMinutes(endTime[1]);
- 2 回答
- 0 关注
- 125 浏览
添加回答
举报