1.0.7 • Published 2 years ago

get-how-long-ago v1.0.7

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

Get-how-long-ago

Put date in miliseconds get how time ago.

Installation

npm i get-how-long-ago

for development

npm i -D get-how-long-ago

Usage

const datetime = require('get-how-long-ago');

console.log(datetime.timeAgo(1612803059959));
console.log(datetime.timeAgo('1612803059959'));   // or type of string

// You can get milliseconds by Date.now()

/* output
{
  minutes: 8,
  seconds: 44,
  in: 'minutes',
  string: '8 minutes & 44 seconds ago'
}
*/

// But if you pass a wrong parameter
console.log(datetime.timeAgo({})); // return null

Usage with typescript

import * as dateTime from "get-how-long-ago";
// or
import { timeAgo } from "get-how-long-ago";

Other functions

const datetime = require('get-how-long-ago');
datetime.secondsAgo()
datetime.minutesAgo()
datetime.hoursAgo()
datetime.daysAgo()

License

MIT

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago