The 'value' should be a Valid Javascript Date instance. When using the Kendo ui’s date Picker

Asked

Viewed 64 times

0

I’m trying to store a date in the bank through the component date Picker do Kendo ui it sends to my bank in this format:

2019-07-23T00:00:00

When I seek it from the bank and assign the value of the bank to it through the

formcontrol.setValue()

i get:

Error: The 'value' should be a Valid Javascript Date instance. Check http://www.telerik.com/kendo-angular-ui/components/dateinputs/datepicker/#toc-using-with-json for possible Resolution.

This is the amount that is coming from my bank: 2019-07-25T00:00:00

<kendo-datepicker [(value)]="ReferenciaMktDataDisponivel" formControlName="ReferenciaMktDataDisponivel"></kendo-datepicker>

I tried to take value and leave formControlName attached but there were no differences.

1 answer

1


Apparently this library expects an instance of the Date type, for that you have to create an object of this type parsing the date that comes from the back

formcontrol.setValue(new Date())

or

formcontrol.setValue(new Date(algumValor))
  • I send to my POST api: Referenceavailable: 2019-07-29T03:00:00.000Z My database saved with this value the Referenceavailable: 2019-07-29 00:00:00.000 if it does, attribute what you have in the backend to the screen data: Referenceavailable: new Formcontrol(new Date(dataItem.Referenceavailable) But get: The 'value' should be a Valid Javascript Date instance. Check http://www.telerik.com/kendo-angular-ui/components/dateinputs/datepicker/#toc-using-with-json

  • worked out, the problem was the child form that was not instantiating that date...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.