Date related error

I have in the ‘collection’ date (8) columns
The date is connected to a text box and is populated based on an action on the page.
When the date columns is empty the page gets an error when loaded:

Due to this error some of the code does not work on some mobile devices.

Any idea?