【发布时间】:2021-05-22 15:05:03
【问题描述】:
我正在使用 ngb 日期选择器。这是我的html
<div class="input-group">
<input class="form-control ngbfield" placeholder="yyyy-mm-dd" required
name="checkdate" [readonly]="true" #vl="ngModel"
[(ngModel)]="profile.checkDate" ngbDatepicker #d1="ngbDatepicker"
required>
<div class="input-group-append">
<button class="btn btn-outline-secondary fa fa-calendar" (click)="d1.toggle()" type="button"></button>
</div>
</div>
目前,日期选择器运行良好。我使用控制台日志检查了它。这是我的控制台日志
这是我的组件文件
export class MyProfileComponent implements OnInit {
profile: any = {};
@ViewChild(NgForm) profileform: NgForm;
dtOptions: DataTables.Settings = {};
constructor(private calendar: NgbCalendar) { }
ngOnInit() {
this.selectToday();
}
selectToday() {
this.profile.checkDate = this.calendar.getToday();
}
addScheduleCheckin(a) {
console.log(a);
alert(a);
}
}
但我需要得到这个日期如下 检查日期:“2021-05-22”
在这个库中有任何选择。
【问题讨论】:
标签: angular ng-bootstrap