1.0.11 • Published 2 years ago

calculate-time v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

ParameterTypeDescription
birthDatestringDate of birth
tostringDate to compare
languageobjectObject with the names of the time units. Example: { year: 'year', month: 'month', day: 'day' }
1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago