Return the date as a string in simplified extended ISO format.
The toISOString() method returns a string in simplified extended ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ), which is always 24 characters long. The timezone is always UTC, as denoted by the suffix Z.
This format is widely used in web APIs, databases, and data interchange because it is unambiguous, sortable, and universally understood. It is the format used by JSON.stringify() when serializing Date objects.
toISOString() throws a RangeError if the date is invalid. It is the recommended method for serializing dates in JSON payloads and API communications.
new Date().toISOString();
// '2024-01-15T12:30:00.000Z'