Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datatypes/interval

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datatypes/interval

ISO 8601 based interval module

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Interval

Module for ISO 8601 based intervals and recurring intervals.

Installation

npm install --save @datatypes/interval

Usage

As separator string it can either be used -- or /. It's recommended to use -- due to the possibility to use it in file names and URLs.

Import interval into your modules like this (ES2015 style):

import Interval, {RecurringInterval} from '@datatypes/interval'

<start moment>--<end moment>

const interval = new Interval('2015-09--2015-11')
const intervalObject = {
	string: test.title,
	start: momentFromString('2015-09'),
	end: momentFromString('2015-11'),
	duration: new Duration('P2184H0M0.0S'),
}

assert.deepEqual(interval.object, intervalObject)

<start moment>--<incomplete end moment>

const interval = new Interval('2015-11-24--30')
const intervalObject = {
	string: test.title,
	start: momentFromString('2015-11-24'),
	end: momentFromString('2015-11-30'),
	duration: new Duration('P168H0M0.0S'),
}

assert.deepEqual(interval.object, intervalObject)

R<number of recurrences>--<start moment>--<duration>

const recurringInterval = new RecurringInterval('R3--2015-11-25T15--P1H30M')
const recurringIntervalObject = {
	string: 'R3--2015-11-25T15--P1H30M',
	numberOfRecurrences: 3,
	start:  momentFromString('2015-11-25T15'),
	end: momentFromString('2015-11-25T16:30'),
	duration: new Duration('P1H30M')
}

assert.deepEqual(recurringInterval.object, recurringIntervalObject)

Check out the test directory for more usage examples!

Keywords

FAQs

Package last updated on 15 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc