SaturnTeam / saturn-datepicker

Angular Material Datepicker with range selection
MIT License
278 stars 110 forks source link

ERROR TypeError: date.getTime is not a function #165

Open ryndm opened 3 years ago

ryndm commented 3 years ago

I get the following error on random occasions

ERROR TypeError: date.getTime is not a function at NativeDateAdapter.push../node_modules/saturn-datepicker/fesm5/saturn-datepicker.js.NativeDateAdapter.isValid (saturn-datepicker.js:693) at NativeDateAdapter.push../node_modules/saturn-datepicker/fesm5/saturn-datepicker.js.DateAdapter.sameDate (saturn-datepicker.js:182) at SatDatepickerInput.set [as value] (saturn-datepicker.js:4388) at SafeSubscriber._next (saturn-datepicker.js:4329) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:196) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:134) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:77) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:54) at Subject.push../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next (Subject.js:47) at SatDatepicker.push../node_modules/saturn-datepicker/fesm5/saturn-datepicker.js.SatDatepicker._selectRange (saturn-datepicker.js:3764)

Any fix to this?

aminesafi8 commented 3 years ago

I think that the returned date is a moment object, try this date.toDate().getTime()