0.0.3 • Published 5 years ago

humanize-from-now v0.0.3

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

humanize-from-now

Generates momentjs like time from now string

About this project

This is a tiny function to genrate the momentjs like time-from-now string. Checkout the momentjs doc for the definitions.

Installation

npm install --save humanize-from-now

Usage

First import this module in your code:

import fromNow from 'humanize-from-now';

Then you can use it like:

const duration = fromNow(time);

the time argument could be the numeric timestamp in milliseconds, a valid js Date string or a js Date object.

you can also set a failover string when the input time is not valid:

const duration = fromNow(time, 'Invalid date');

and... That's it! Have fun!

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago