Date format storeeval


On page

I look this

var d= new Date(); var m=((d.getMonth()+1)<10)?'0'+(d.getMonth()+1):(d.getMonth()+1); d.getFullYear()+"-"+m+"-"+d.getDate();

For Get todays date in YYYY-MM-DD format

But i look the day is D not DD for today this storeeval give me 2019-04-7

How can I edit the javascript to obtain from 2019-04-7 to 2019-04-07 in date format ?