ngrx-forms icon indicating copy to clipboard operation
ngrx-forms copied to clipboard

Error thrown when setting a date field to null

Open aiscrim opened this issue 3 years ago • 1 comments

Describe the bug If a form contains a date field that was initialized with a date, and the user then clears that field, it is set to null. This makes the reducer throw an error at this line.

The error is: ERROR TypeError: Cannot convert undefined or null to object at Function.keys ()

To Reproduce Steps to reproduce the behavior:

  1. Create form state with a date value
  2. Clear the date input
  3. See error in the console

Library version: 6.3.6

aiscrim avatar Jan 18 '22 17:01 aiscrim

If you have a Date object you might want to learn more about Value Conversion to let ngrx-forms handle it internally as a string, potentially avoiding your error.

Back to your specific issue, would be interesting to know how you handle the date (what HTML form element is displaying it) and how you clear the field (what value you see and how).

Balastrong avatar Mar 20 '22 19:03 Balastrong