1.0.2 • Published 3 years ago

const-ms2 v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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:

Milisecond to time converter methods:

To milisecond converter:

ms.secondInMs(1);
//---> 1000
ms.minuteInMs(1);
//---> 60000
ms.hourInMs(1)
//---> 3600000
ms.dayInMs(1)
//---> 86400000
ms.weekInMs(1)
//---> 604800000
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(1)
//---> 31536000000

To time converter:

// 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'.