ms / 0.7.1 last updated a year ago created on Dec 21st 2011

Install

npm install --save ms

Clone

git clone git@github.com:guille/ms.js.git

dependencies

No dependencies listed.

maintainers

rauchg rauchg

versions 11 total

0.7.1 a year ago rauchg
0.7.0 2 years ago rauchg
0.6.2 3 years ago rauchg
0.6.1 3 years ago rauchg
0.6.0 3 years ago rauchg
0.5.1 3 years ago rauchg
0.5.0 4 years ago rauchg
0.4.0 4 years ago rauchg
0.3.0 4 years ago rauchg
0.2.0 4 years ago rauchg
0.1.0 5 years ago rauchg
297875 Downloads yesterday.

readme

ms.js: miliseconds conversion utility

1
2
3
4
5
6
7
8
ms('2 days')  // 172800000
ms('1d')      // 86400000
ms('10h')     // 36000000
ms('2.5 hrs') // 9000000
ms('2h')      // 7200000
ms('1m')      // 60000
ms('5s')      // 5000
ms('100')     // 100
1
2
3
ms(60000)             // "1m"
ms(2 * 60000)         // "2m"
ms(ms('10 hours'))    // "10h"
1
2
3
ms(60000, { long: true })             // "1 minute"
ms(2 * 60000, { long: true })         // "2 minutes"
ms(ms('10 hours'), { long: true })    // "10 hours"
  • Node/Browser compatible. Published as ms in NPM.
  • If a number is supplied to ms, a string with a unit is returned.
  • If a string that contains the number is supplied, it returns it as a number (e.g: it returns 100 for '100').
  • If you pass a string with a number and a valid unit, the number of equivalent ms is returned.

License

MIT

Resolving all dependencies.. This could take a while as our cache is not yet fully warmed up.