SQL and JS dates are not that compatible.
datetime type of MySQL for example you need a date in the following format
The suggestions that you usually find on the internet aren't correct, because they don't tate timezones into consideration.
So this does not work correctly!
new Date().toISOString().slice(0, 19).replace('T', ' ');
You can easily solve the problem by using moment.js
If you don't want to go this route, you can also solve it without an additional library - it just doesn't read as nicely.
const d = new Date(); d.toISOString().split('T')+' '+d.toTimeString().split(' ');