hms-parse

1.0.0 • Public • Published

hms-parse npm downloads tests maintained

Parse hms time strings to and from seconds

Install

npm install --save hms-parse

Usage

const hms = require('hms-parse')
 
let seconds
seconds = hms.toSeconds(['1h', '45m', '10s']) // => 6310
seconds = hms.toSeconds(['45m', '10s']) // => 2710
seconds = hms.toSeconds(['10s']) // => 10
seconds = hms.toSeconds(['1s', '5S', '10m', '4M', '3h', '1H']) // => 15246
 
let timeString
timeString = hms.fromSeconds(6310) // => '1:45:10'
timeString = hms.fromSeconds(2710) // => '45:10'
timeString = hms.fromSeconds(10) // => '10s'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    5

Package Sidebar

Install

npm i hms-parse

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • fvgs