JSFiddle - React, Tailwind, and code Playground
by brigand
HTML
<pre id="output"></pre>
JavaScript
function fixDate(string) {
return string.replace(/(\d\d\d\d-\d\d-\d\d) (\d\d:\d\d:\d\d)/, '$1T$2').replace(/(\d)$/, '$1Z');
}
output.textContent += fixDate('2020-04-01 10:34:06')
output.textContent += '\n'
output.textContent += fixDate('2020-04-01T10:34:06Z')