0.1.4 • Published 7 years ago

iso8601-repeating-interval v0.1.4

Weekly downloads
23
License
ISC
Repository
github
Last release
7 years ago

iso8601-repeating-interval

A module for parsing ISO 8601:2004 dates that involve a repeating interval.

Read about ISO 8601 Repeating Intervals over on Wikipedia

Also, the PDF of the actual ISO Standard is floating around if you google for it.

Installation

npm install iso8601-repeating-interval --save

Usage

const makeInterval = require('iso8601-repeating-interval')

const interval = makeInterval('R/2017-01-01/P3M')
console.log(interval.firstAfter('2017-06-05'))
//{
//  index: 2,
//  date: moment("2017-07-01T00:00:00.000")
//}

Rational

I really like https://github.com/enriched/repeating-interval but it handles months in a way I don't like. A month is converted to a fix duration of 30 days which means R/2017-01-15/P1M returns the following dates:

2017-01-15,2017-02-14,2017-03-16

I.e. the day of the month changes depending on month length.

This package returns as follows:

2017-01-15,2017-02-15,2017-03-15
0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago