nebular
nebular copied to clipboard
Date-TimePicker adding errors to FormControl despite date being correct
Issue type
I'm submitting a ...
- [x] bug report
- [ ] feature request
Issue description
Current behavior:
When selecting a Date on a form, the Date-TimePicker Component is setting the form as invalid by adding values to the error array.

Expected behavior: The FormControl errors array should not have any values and formControl.valid should return true
Steps to reproduce: Pick a date and see output from printErrors on console
Related code: HTML
<input nbInput [nbDatepicker]="wdd"
formControlName="WishedDeliveryDate" fieldSize="small" fullWidth
[status]="form.controls['WishedDeliveryDate'].errors?.invalidDate ? 'danger' : 'basic'" (ngModelChange)="printErrors()">
<nb-date-timepicker #wdd singleColumn [step]="15" [min]="minDateForPicker"></nb-date-timepicker>
Typescript
// setting formControl inside formGroup
WishedDeliveryDate: [this.order.WishedDeliveryDate != null ? new Date(this.order.WishedDeliveryDate) : '', [invalidDateValidator()]],
// print errors
printErrors(){
console.log('-------------------')
console.log(this.form.controls['WishedDeliveryDate'].errors)
console.log('-------------------')
}
invalidDateValidator does not set either of those errors. (setting a error like { invalidDate:true } )
Other information:
npm, node, OS, Browser
Node; npm: v14.17.5; 8.3.0
OS: Windows 10 AND MacOS
Browser: All (Safari, Chrome, Edge, Firefox tested)
Angular, Nebular
Angular: 13.2.0
Nebular: 9.0.0
Note: I've tried with either NbDateFnsDateModule active and not active.