Keep Date as NULL value when blank/none chosen

I have a form that has 4 datepicker fields. These dates are optional and are stored in the database as NULL if it has not been set.

Currently when I update the form and leave one of those date fields blank, it saves it in the database as 1900-01-01 instead of leaving it as a NULL value.

What can I do so if the field is blank that it stays as a null value upon save?


I think I've found one way to do it is by changing from using the Object changeset ( {{}} ) to individual Key-Value pairs and using a ternary statement in the value field to check for an empty date. My form has 30 fields so it is a little tedious.

One of the key-value pairs looks like this now....

My newest issue now is that once the date picker field has a date, I don't think there is a way to leave that field blank again. Escape key doesn't work because it closes the modal. (EDIT: Found the showClear option that adds an X to the field and clears out the value and in conjunction with the key-value pair solution, works for me).


Thanks for this!