This is a migrated thread and some comments may be shown as answers.

Reactive Form with null date

3 Answers 603 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 18 Mar 2019, 02:16 PM

How can I use the Kendo-datepicker when I am using Reactive forms and the date field is nullable. So sometimes there is a date and sometimes there is not. I can't seem to make this work. An example of how to make this work would help.

Currently, if the date is null or undefined, I get this HTML error:  "ERROR TypeError: Unable to get property 'toString' of undefined or null reference"

 

Any advice would help.

Thanks

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin
Telerik team
answered on 20 Mar 2019, 12:39 PM
Hi Tim,

Thank you for the provided information.

I tried to reproduce the reported undesired behavior of the DatePicker component using Reactive Forms, but there is no such error when the value is set to null. Check the following demo example demonstrating the functionality: 
https://stackblitz.com/edit/angular-c1p95i?file=app/app.component.ts

Let me know in case I am missing something.

If further assistance is required for this case, could you provide some more detailed information about the use case scenario. Thank you in advance.

Regards,
Martin
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Tim
Top achievements
Rank 1
answered on 25 Mar 2019, 05:06 PM

Martin, 

Thanks for your response. Using your example I was able to make this work. 

Tim

0
Thamarai
Top achievements
Rank 1
Veteran
answered on 05 Mar 2021, 06:58 AM

Hi,

I get Date from datepicker using formcontrol ,

1.its getting date with time zone,

2. Some time its give yesterday date

 

i picked march 8 but i am getting this format yesterday date

E.g : "2021-03-07T18:30:00.000Z"

 

How to resolve this issue, any thing we want change

Thanks.

Tags
DatePicker
Asked by
Tim
Top achievements
Rank 1
Answers by
Martin
Telerik team
Tim
Top achievements
Rank 1
Thamarai
Top achievements
Rank 1
Veteran
Share this question
or