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
247 stars 248 forks source link

Object passed to input's (change) handler is an HTML Event when input is manually edited #344

Open manwithtwowatches opened 3 years ago

manwithtwowatches commented 3 years ago

Angular version: 2+ component version: 4.0.1

When manually entering text into the input field to change the date range and then clicking "Apply", the object passed to the input's (change) handler, instead of being the expected { startDate, endDate } object, is an HTML Event object.

I would expect this to always be a starDate endDate object. This is problematic for object reasons. It is possible to extract the dates from the event.target.value but it's plain text and some of the functionality is lost. For example if selecting a single day, the date range will be to the start of the next day (00:00:00) instead of to the end of the day (23:59:59).

manwithtwowatches commented 3 years ago

Looking at the code, it is not obvious to me why this happens, however it can be avoided by using the (datesUpdated) output instead.