 parseISO
Parse ISO string
Description
Parse the given string in ISO 8601 format and return an instance of Date.
Function accepts complete ISO 8601 formats as well as partial implementations.
ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
If the argument isn't a string, the function cannot parse the string or
the values are invalid, it returns Invalid Date.

Usage
// CommonJS
var parseISO = require('date-fns/parseISO')
// ES 2015
import parseISO from 'date-fns/parseISO'
// ESM
import { parseISO } from 'date-fns'
Syntax
parseISO(argument, [options])
Arguments


Name
Description


argument
the value to convert



options
an object with options.



options.additionalDigits
the additional number of digits in the extended year format



Returns


Description


the parsed date in the local time zone



Exceptions


Type
Description


TypeError
1 argument required



RangeError
options.additionalDigits must be 0, 1 or 2



Examples
// Convert string '2014-02-11T11:30:30' to date:
const result = parseISO('2014-02-11T11:30:30')
//=> Tue Feb 11 2014 11:30:30
// Convert string '+02014101' to date,
// if the additional number of digits in the extended year format is 1:
const result = parseISO('+02014101', { additionalDigits: 1 })
//=> Fri Apr 11 2014 00:00:00


                
{'path': 'public/docs/date_fns/parseISO.html', 'source': 'DevDocs.IO'}