ConstMS - Is the better milisecond converter!
NOTE:
This is the second version of the package, the first has been deprecated.
Instalation:
$ npm install const-ms2
Statements:
const ms = require("const-ms2");
Docs:
Methods:
To milisecond converter methods:
- .secondInMs(value)
- .minuteInMs(value)
- .hourInMs(value)
- .dayInMs(value)
- .weekInMs(value)
- .monthInMs(value, optional:monthDays)
- .yearInMs(value)
Milisecond to time converter methods:
To milisecond converter:
[ms].secondInMs(value)
ms.secondInMs(1);
//---> 1000
[ms].minuteInMs(value)
ms.minuteInMs(1);
//---> 60000
[ms].hourInMs(value)
ms.hourInMs(1)
//---> 3600000
[ms].dayInMs(value)
ms.dayInMs(1)
//---> 86400000
[ms].weekInMs(value)
ms.weekInMs(1)
//---> 604800000
[ms].monthInMs(value)
ms.monthInMs(1)
//---> 2592000000
//Do you can put the month days(30, or 31).
ms.monthInMs(1, 30)
//---> 2592000000
ms.monthInMs(1, 31)
//---> 2678400000
[ms].yearInMs(value)
ms.yearInMs(1)
//---> 31536000000
To time converter:
[ms].time(value, configs)
// The {configs} paramether is optional, if do you not use, he is set to 'all'.
ms.time(31536000000)
//---> 1 years, 12 months, 52 weeks, 365 days, 8760 hours, 525600 minutes, 31536000 seconds
// You can use pre-set keys to filter years, months, weeks, days, hours, minutes and seconds!
// Examples:
ms.time(31536000000, 'days')
//---> 365 days
ms.time(31536000000, 'years')
//---> 1 years
// The existing pre-set keys are: 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' and 'all'.