calculate-time

1.0.11 • Public • Published

Calculation of time between dates

License: MIT

Description

Calculation of time between dates

Installation

npm i calculate-time

Usage

// Usage example:
import calculateTime from 'calculate-time';
const birthDate = '1990-01-15'; // Birthdate
const toDate = '2023-09-18'; // Date to compare
const language = {
  year: 'year',
  month: 'month',
  day: 'day',
};

const result = calculateTime(birthDate, toDate, language);

console.log(result); // Example output: "33 years 8 months 3 days"
import calculateTime from 'calculate-time';

const experienceTime_1 = '2010-01-01'; // Date of the first experience
const experienceTime_2 = '2015-01-01'; // Date of the second experience

const experience = calculateTime(experienceTime_1, experienceTime_2); // Example output: "4 years 0 months 0 days"

console.log(experience);

Parameters

Parameter Type Description
birthDate string Date of birth
to string Date to compare
language object Object with the names of the time units. Example: { year: 'year', month: 'month', day: 'day' }

Package Sidebar

Install

npm i calculate-time

Weekly Downloads

0

Version

1.0.11

License

MIT

Unpacked Size

3.98 kB

Total Files

3

Last publish

Collaborators

  • rustemliqudret