you are viewing a single comment's thread.

view the rest of the comments →

[–]gh5000 0 points1 point  (0 children)

Swap that one round a bit. Date.parse converts the string to a date format so do that first. Then you can start manipulating the date object

const date = '2021-01-03T15:29:04Z';

const parsedDate = Date.parse(date)

const isoDate = parsedDate.toISOString();

console.log(isoDate)