The tag input type="date-time" was discontinued:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime
And was replaced by the tag input type="datetime-local":
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
document.getElementById("datetime").defaultValue = new Date().toLocaleDateString();
<html>
<body>
<input id="datetime" type="datetime-local">
</body>
</html>
Obs: Does not work on I.E and Firefox: Chrome OK; Opera OK;
The guy input type="date" has support in firefox from version 57.0, in Chrome since 22;
document.getElementById("datetime").value = new Date().toLocaleDateString();
<html>
<body>
<input id="datetime" type="date">
</body>
</html>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/data
Considerations: There are still many inconsistencies in these inputs the input
type="datetime-local", o DOM properties defaultValue works only on firefox, Chromium does not work but DOM properties
value works.
The input type="date" the DOM porperties value does not work in the
firefox also does not work on Chromium.
And then, in your browser it worked?
Posting the code snippet makes it easier to get help.
– alxwca