To create an ISO date object in JavaScript, we call the toISOString
method.
For instance, we write
const isoDate = new Date().toISOString();
to create a date with the Date
constructor.
And then we call toISOString
to return the ISO string version of the date and time.