Skip to content

Date range checker including durations at repeating intervals as specified in ISO8601.

License

Notifications You must be signed in to change notification settings

gausie/iso8601-interval-recurrence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iso8601-interval-recurrence

Build Status Code Coverage

This small library allows you tocheck if a date is within a range. Support includes repeating ranges using the ISO 8601 standards of Durations and Repeating Intervals.

This can be supplied a range with describes a duration at a repeating interval (for example between 9:15 and 4 every other Thursday) and can tell you if a date falls within one of those ranges.

Usage

var IntervalRecurrence = require('iso8601-interval-recurrence');

var range = {
    interval: '2015-07-22T00:00:00.000Z/P1D',
    recurrence: 'R/P1W'
};

var every_wednesday = new IntervalRecurrence(range);

var wednesday = '2015-07-29T13:00:00.000Z';
var tuesday = '2015-07-23T11:12:13.000Z';

every_wednesday.containsDate(wednesday); // true
every_wednesday.containsDate(tuesday);   // false

Although I will write some more documentation later, for now you can see the unit testing to determine how to use it.

See Also

The guys over at cylc seemed to have the same problem but came up with a complicated and extremely confusing solution.

I worked on this with Joshua Finch, who has published an equivalent library for iOS.

About

Date range checker including durations at repeating intervals as specified in ISO8601.

Resources

License

Stars

Watchers

Forks

Packages

No packages published