duration-to-ms

Library for converting duration string to ms

Usage no npm install needed!

<script type="module">
  import durationToMs from 'https://cdn.skypack.dev/duration-to-ms';
</script>

README

NPM version NPM downloads MIT License Build Status

A JavaScript library for converting duration string into milliseconds.

Example:

  import durationToMs from 'duration-to-ms'

  const DURATION = '24h'

  durationToMs(SESSION_DURATION)
  ms: millisecond
  s: second
  m: minute
  h: hour
  d: day
  w: week
  y: year