Licence
MIT
Version
2.1.2
Deps
7
Size
351 kB
Vulns
0
Weekly
0
to-iso-string-x
Cross-browser toISOString support.
module.exports ⇒ string
This method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHHss.sssZ or ±YYYYYY-MM-DDTHHss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix "Z".
Kind: Exported member
Returns: string - Given date in the ISO 8601 format according to universal time.
Throws:
TypeErrorIf date is not a Date object.RangeErrorIf date is invalid.
| Param | Type | Description |
|---|---|---|
| date | Object |
A Date object. |
Example
import toISOString =from 'to-iso-string-x';
toISOString(new Date(0)); // '1970-01-01T00:00:00.000Z'