Blank date field


#1

Hi all,

I allow users of an app to update a few date fields (input type=“date”) inside an ionic app.

These date fields are optional so there are instances where a blank date field is valid. The date values are supplied by an API which stores them in a mySQL database in the YYYY-MM-DD format. I’ve tried supplying the dates as an empty string or ‘0000-00-00’ but angularjs forcefully tries to interpret this and fills the input with the date 30/11/1899 which I obviously don’t want.

How do I get around this? Do I have to ditch the type=“date” declaration?


#2

You should try to assign null instead of ‘0000-00-00’. Hope this will solve your issue.


#3

Nice one, thank you, will give it a go!