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

parse-iso-duration

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-iso-duration

Parse an ISO 8601 duration to milliseconds

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by142.52%
Maintainers
1
Weekly downloads
 
Created
Source

node-parse-iso-duration

Parse an ISO 8601 duration to milliseconds

Instalation

npm install --save parse-iso-duration

Usage

var parseIsoDuration = require('parse-iso-duration');

parseIsoDuration('PT8S');   // 8 * 1000
parseIsoDuration('PT10M');  // 10 * 60 * 1000
parseIsoDuration('PT20H');  // 20 * 60 * 60 * 1000
parseIsoDuration('PT6M4S'); // 6 * 60 * 1000 + 4 * 1000

parseIsoDuration('Hello world'); // Throws "Invalid duration"
parseIsoDuration('P10Y10M10D');  // Throws "Ambiguous duration"

Year and month

If years or months is specified and more than 0 the library will throw "Ambiguous duration" since it's meaning can't be converted to milliseconds.

License

MIT

FAQs

Package last updated on 04 Aug 2019

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