How to set a date format like this (2020-03-10) when submitting a edited form. That form is currently reading a current data from DB (e.g 20-10-1990). I find below solution, the formating is what I want but it is reading a today's date (2020-03-27), not as what as current DB data.
I must send in YYYY-MM-DD format, DB will save as 0000-00-00 00:00:00 if not follow that format.
Current Date as in DB
Console.log when submitting using code below
Code that I am using to get YYYY-MM-DD
var d = new Date();
editProjectPlanStart = [
d.getFullYear(),
('0' + (d.getMonth() + 1)).slice(-2),
('0' + d.getDate()).slice(-2)
].join('-');