Setting the date in date field sets it with one day before [duplicate]
It's the timezone difference read this.
Apparently when using new Date()
you use the current time zone and valueAsDate
takes a GMT dateTime
Changing you code to something like this
console.log(myInput.valueAsDate = new Date(1995, 0, 1,12));
should work
Update 1
console.log(myInput.valueAsDate = new Date(Date.UTC(1995, 0, 1));
Should work on all timezones.