I’ve created a basic form in React to save a name, category, and date if available to an SQL table. My form is acting fine – it’s submitting correctly and saving the new entries. The problem is, while it saves the name and the category fine, if you choose a date (using the HTML date picker) the date isn’t getting saved. It’s definitely seeing the date in the state upon change, but it won’t save to the SQL table. Instead it’s saving the state as “null.”
When I use Terminal to add an item, I’m able to set the date when using an INSERT command, and it will save.
Advertisement
Answer
Without any code it’s quite difficult to debug. It could be the format of the date value you’re using, can you console.log
the date before you send it off the SQL server?
Additionally, depending on how you’re interacting with the SQL server you could open up the dev tools and go to the Network tab and see what’s in the HTTP POST request?