Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@segment/isodate

segmentio3mSEE LICENSE IN LICENSE1.0.3TypeScript support: definitely-typed

Parse an ISO date string into a Date

date, isodate

readme

isodate

CircleCI Codecov

Parse an ISO date string into a Date. Works cross-browser, even in the old, dumb ones ;)

Installation

$ npm install @segment/isodate

Example

var isodate = require('isodate');

var date = isodate.parse('2013-09-04T00:57:26.434Z');
date.toISOString(); // "2013-09-04T00:57:26.434Z"
var isodate = require('isodate');

isodate.is('2013-09-04T00:57:26.434Z'); // true
isodate.is('string'); // false

API

.parse(string)

Parse the given ISO date string into a native Date object.

.is(string, strict)

Check if the given string is an ISO date string. strict mode will return false for strings without a year, month and date; for example 2013 would be false.

changelog

1.0.3 / 2017-10-12

  • Check type in .is() (#6)

1.0.2 / 2016-05-11

  • Remove IE6 support

1.0.1 / 2016-05-11

  • Modernize test harness
  • Fix broken test case on IE <= 8
  • Formatting and fix linting errors

1.0.0 / 2016-04-07

  • add circle.yml
  • Makefile: add "node_modules" dep to test
  • remove component support, add browserify support

0.0.2 - July 2, 2014

  • fix case where milliseconds start with a zero

0.0.1 - September 3, 2013

:sparkles: