JSFiddle - React, Tailwind, and code Playground
HTML
<h2>Date formatting (use a browser with date implementation eg chrome)</h2>
<h3>input[type=date]</h3>
<input type="date" value="2017-12-13" />
<h3>input[type=text] with toLocaleDateString()</h3>
<input type="text" value="" />
CSS
input
{
width:160px;
}
JavaScript
var d = new Date();
document.querySelector("input[type=date]").value = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
document.querySelector("input[type=text]").value = d.toLocaleDateString();