remaining-period-calculator

1.0.8 • Public • Published
Remaining period calculator is calculates between the two periods => past or future

Install

npm install remaining-period-calculator --save

Usage

var rpc = require("remaining-period-calculator");
var remaining = new rpc.remainingPeriodCalculator(/*option*/); // The example Date now is : 13/2/2021
console.log(remaining.remainingYears(2025));    //  result: 4 Years
console.log(remaining.remainingYears(2015));    //  result: 6 Years
console.log(remaining.remainingMonths(4,2023)); //  result: 26 Month
console.log(remaining.remainingMonths(4)); //  result: 2 Month
console.log(remaining.remainingDays(10,5,2019));//  result: 633 Days
console.log(remaining.remainingDays(10,5));//  result: 87 Days
console.log(remaining.remainingDays(10));//  result: 3 Days

Options

Key Type Default
day Number Current day
month Number Current month
year Number Current year
timeZone Number 0

Range

Key range
day (1 -- 31)
month (1 -- 12)
timeZone (-12 -- 12)

example

// Example change default date
var remaining = new rpc.remainingPeriodCalculator({day:27,month:6,year:2009,timeZone:3});

// Past remaining
console.log(remaining.remainingYears(1999));    //  result: 10 Years
console.log(remaining.remainingMonths(5,1999)); //  result: 121 Month
console.log(remaining.remainingDays(15,5,1999));//  result: 3642 Days
// Futur remaining
console.log(remaining.remainingYears(2019));    //  result: 10 Years
console.log(remaining.remainingMonths(5,2019)); //  result: 119 Month
console.log(remaining.remainingDays(15,5,2019));//  result: 3558 Days

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i remaining-period-calculator

      Weekly Downloads

      1

      Version

      1.0.8

      License

      ISC

      Unpacked Size

      5.6 kB

      Total Files

      3

      Last publish

      Collaborators

      • bemoxpro