iso8601-date

Lib for working with simplified ISO 8601 Date format


Keywords
date, iso8601
License
MIT
Install
npm install iso8601-date@0.0.4

Documentation

JS-iso8601

Java script lib for working with simplified ISO 8601 Date format

Supported formats:

  • 2010-12-07T01:02:03.123-01:12
  • 2010-12-07T01:02:03-01:12
  • 2010-12-07T01:02:03Z
  • 2010-12-07T01:02:03
  • 2010-12-07

Defaults

  • Assumed local timezone if not specified
  • T24:00 is the beginning of next day

TODO

  • Add test

Examples

System timezone is UTC-8

iso8601Date.parse("2010-12-07T01:02:03") // Tue Dec 07 2010 01:02:03 GMT-0800 (Pacific Standard Time (Mexico))
iso8601Date.parse("2010-12-07T24:00:00") // Wed Dec 08 2010 00:00:00 GMT-0800 (Pacific Standard Time (Mexico))
iso8601Date.parse("2010-12-07")  // Tue Dec 07 2010 00:00:00 GMT-0800 (Pacific Standard Time (Mexico))
iso8601Date.parse("2010-12-07T00:00:00Z") // Mon Dec 06 2010 16:00:00 GMT-0800 (Pacific Standard Time (Mexico))
iso8601Date.parse("2010-12-07T00:00:00+02:00") //Mon Dec 06 2010 14:00:00 GMT-0800 (Pacific Standard Time (Mexico))