JSFiddle - React, Tailwind, and code Playground

JavaScript

var thisDate = new Date();

alert(thisDate.getFullYear() + '-' + ("0" + (thisDate.getMonth() + 1)).slice(-2) + '-' + ("0" + (thisDate.getDate() + 1)).slice(-2));