I used the following script to autofill an input date with current date/time
var today = moment().format('YYYY-MM-DD');
document.getElementById("MyDate").value = today;
Output :
Date : 2022-03-09 11:39:19.000000,3,Europe/Berlin
Would it be possible to remove the timezone... etc.
So the output will look like :
Date : 2022-03-09 11:39:19
you can use moment().utc() before format the date to have an universal date and then format it as expected
var today = moment().utc().format('YYYY-MM-DD');
document.getElementById("MyDate").value = today;
<div>
Date : <input id ="MyDate"/>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>