xxxxxxxxxx
const now = (new Date().toLocaleString("sv-SE") + '').replace(' ','T');
xxxxxxxxxx
var now = new Date();
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
document.getElementById('dt').value = now.toISOString().slice(0,16);
xxxxxxxxxx
<input id="dt" type="datetime-local" />
Run code snippetHide results