ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

JS errors when typing text inside calendar #71

Closed msaccone closed 7 years ago

msaccone commented 7 years ago

If accidentally the user starts typing inside the input, the calendar crashes and won't be available again to select a date, until a complete page refresh. capture capture2

EXCEPTION: Error in ./DateTimePickerComponent class DateTimePickerComponent - inline template:7:12 caused by: Cannot read property 'fullName' of undefinedErrorHandler.handleError @ error_handler.js:45next @ application_ref.js:273schedulerFn @ async.js:82SafeSubscriber.tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:120onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:72NgZone.runGuarded @ ng_zone.js:236outsideHandler @ dom_events.js:26ZoneDelegate.invokeTask @ zone.js:236Zone.runTask @ zone.js:136ZoneTask.invoke @ zone.js:304 error_handler.js:47 ORIGINAL EXCEPTION: Cannot read property 'fullName' of undefinedErrorHandler.handleError @ error_handler.js:47next @ application_ref.js:273schedulerFn @ async.js:82SafeSubscriber.__tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:120onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:72NgZone.runGuarded @ ng_zone.js:236outsideHandler @ dom_events.js:26ZoneDelegate.invokeTask @ zone.js:236Zone.runTask @ zone.js:136ZoneTask.invoke @ zone.js:304 error_handler.js:50 ORIGINAL STACKTRACE:ErrorHandler.handleError @ error_handler.js:50next @ application_ref.js:273schedulerFn @ async.js:82SafeSubscriber.tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:120onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:72NgZone.runGuarded @ ng_zone.js:236outsideHandler @ dom_events.js:26ZoneDelegate.invokeTask @ zone.js:236Zone.runTask @ zone.js:136ZoneTask.invoke @ zone.js:304 error_handler.js:51 TypeError: Cannot read property 'fullName' of undefined at _View_DateTimePickerComponent0.detectChangesInternal (DateTimePickerComponent.ngfactory.js:318)

0cv commented 7 years ago

Can you share a plunkr or compare your code to the plunkr of the Readme: https://plnkr.co/edit/su2aiL ? If you try editing the input you see there (avoid the first one ... :) ), you will see that it works pretty well.

msaccone commented 7 years ago

Hi @Krisa,

Thanks for your answer and examples.

The plunkr doesn't throw an Exception, but all calendars stop working when text is entered manually. Try two or more times, it doesn't happen at first

Hope these hints helps!

ng2-datetimepicker

0cv commented 7 years ago

That only appears if you provide a date which cannot be parsed. But typing this manually will for example work: image

msaccone commented 7 years ago

You're right, but I think the main problem is that if the user accidentally enters some data that can't be parsed, then the datetime picker stops working until a full refresh of the page.

allenhwkim commented 7 years ago

This error seems solved after re-factoring, but defaulting to the current date. Please make it sure the change is correct.