We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot read property 'getFullYear' of undefined

Hello,

I am using the DatePicker component in my application and am getting the error noted in the title. The component works as expected, but I am trying to get rid of the console error. I have copied a portion of the stack trace, which can be found below:

ERROR TypeError: Cannot read property 'getFullYear' of null
    at DatePickerComponent.CalendarBase.compareMonth (ej2-calendars.es5.js:1393)
    at DatePickerComponent.CalendarBase.iconHandler (ej2-calendars.es5.js:1029)
    at DatePickerComponent.CalendarBase.renderTemplate (ej2-calendars.es5.js:825)
    at DatePickerComponent.Calendar.renderTemplate (ej2-calendars.es5.js:1574)
    at DatePickerComponent.CalendarBase.renderMonths (ej2-calendars.es5.js:535)
    at DatePickerComponent.Calendar.renderMonths (ej2-calendars.es5.js:1562)
    at DatePickerComponent.CalendarBase.createContentBody (ej2-calendars.es5.js:293)
    at DatePickerComponent.CalendarBase.onPropertyChanged (ej2-calendars.es5.js:957)
    at DatePickerComponent.Calendar.onPropertyChanged (ej2-calendars.es5.js:1630)
    at DatePickerComponent.DatePicker.onPropertyChanged (ej2-calendars.es5.js:2743)
    at DatePickerComponent.Base.dataBind (ej2-base.es5.js:1171)
    at DatePickerComponent.Component.dataBind (ej2-base.es5.js:5161)

I can provide a larger stack trace if required.

Thanks!

3 Replies

DL Deepa Loganathan Syncfusion Team January 21, 2019 08:23 AM UTC

Hi Altan,  
 
Thanks for contacting Syncfusion Support.  
 
We have analyzed the reported issue in Datepicker. Based on the stack trace provided in your update, we suspect that the reported issue was because, you were trying to access the Datepicker component even before the component is loaded in DOM.  
 
The EJ2 controls will be rendered and available in page for access only in the NgAfterViewInit life cycle event. So kindly check if you were accessing the controls’ instance before NgAfterViewInit event, in that case the console error might occur.  
 
Also, we have tried to reproduce the issue with a simple test sample and we were unable to reproduce the issue. Please find the test sample in below link.  
 
 
If this is not the case, kindly get back to us with the below details. 
 
1.      An issue reproducible sample by editing the above sample 
2.      Exact steps to replicate the reported issue.  
 
The details you provide will help us analyze further and provide a prompt solution based on your application requirement.  
 
 
Regards,  
Deepa L. 



AH Alex Herbig April 3, 2019 05:46 PM UTC

Hello,

I've been able to reproduce this bug. I've included steps to reproduce the bug (and another one) in the html on the example. Please let me know if there's something I'm doing wrong. If possible, could you show me a way to accomplish the functionality displayed in the stackblitz without getting the errors from syncfusion?

https://stackblitz.com/edit/angular-3pav9e-vw2rf5


AB Ashokkumar Balasubramanian Syncfusion Team April 4, 2019 01:47 PM UTC

Hi Altan, 
 
Sorry for the inconvenience. 
We were able to reproduce the reported issue “Cannot read property 'getFullYear' of null while assigning min value as null and Cannot read property 'classList' of undefined” while pass the min value if showTodayButton as false were confirmed as a bug at our end. This fix will be included in our upcoming patch release scheduled on 16th April 2019. We appreciate your patience until then. Please find the feedback link below. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon