/week-date

Primary LanguageJavaScriptMIT LicenseMIT

Version Tests Coverage Status License

ISO Week Date Parser

The built-in Date.parse in Node.js won't parse ISO 8601 Week-Date format, sadly. Here's a function which will. Use it as a drop-in replacement for Date.parse.

Installation

npm install --save week-date

Usage

import WeekDate from 'week-date'

Date.parse('2020-02-29')
// => 1582934400000
new Date(Date.parse('2020-02-29'))
// => 2020-02-29T00:00:00.000Z

WeekDate.parse('2020-W09-6')
// => 1582934400000
new Date(WeekDate.parse('2020-W09-6'))
// => 2020-02-29T00:00:00.000Z

References