fetrarij / ngx-daterangepicker-material

Pure Angular 2+ date range picker with material design theme, a demo here:
https://fetrarij.github.io/ngx-daterangepicker-material/
MIT License
249 stars 252 forks source link

displayed date doesn't change when input changes #389

Open paolo-ciucci opened 3 years ago

paolo-ciucci commented 3 years ago

Versions

Describe the bug if a custom format it's selected, the datepicker is not updating the displayed dates when they get changed by typing in the input field.

To Reproduce Apply a custom format to the datepicker: NgxDaterangepickerMd.forRoot({ ..., format: 'DD/MM/YYYY' })

once the datepicker is open, change the input date, the selected date won't change.

Expected behavior the displayed start/end date should change along with the input.

Screenshots bug

Additional context this is caused by if (!start.isValid() || !end.isValid()) inside inputChanged(e) function. The isValid() check fails because, since a custom format has been selected, dayjs needs CustomParseFormat as shown here (which is not currently imported) to parse strings correctly. This can be fixed importing CustomParseFormat in the component.