0.6.0 • Published 2 years ago

tinycron v0.6.0

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

Tinycron

The low-weight library to handle date objects in a human-readable way

Install

To use this library you can install it via npm

npm install tinycron

How to use it

To use this tool you must import the package in your code

import Tinycron from 'tinycron'

Or

const tinycron = require('tinycron')

Now create an instance of Tinycron class.

const date = new Date(1998, 9, 19);
const tinycron = new Tinyscron(date);

After that, you can call the method toNow to show the time between the specificied date and the current date

const result = tinycron.toNow();
console.log(result); // 22 years ago

Parameters

nametypedescriptionrequired
dateDateThe date you want to compare withtrue
langstringLanguage to show. Ex: en, es ...false

Methods

toNow

Return a string with the elapsed time between the base date and current date. Ex:

tinycron.toNow(); // A minute ago

to:

Receive a date object as a parameter and return a string with the elapsed time between the base date and specified date. Ex:

tinycron.to(new Date()); // A minute ago