Package Exports
- a-while-ago
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (a-while-ago) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Install
$ npm install a-while-agoUsage
const awa = require('a-while-ago');
console.log(awa(new Date() - 1000));
// => a second agoAPI
awa(date)
- date: A past date
Example:
awa(new Date() - 1000)
// => a second ago
awa(new Date() - 60 * 2000);
// => 2 minutes agoawa(date, short)
- date: A past date
- short (
boolean): A past date
Example:
awa(new Date() - 60 * 2000, true);
// => 2mRelated
- minutes-to-read: How long does it take you to read something.
Todo
- Support for sufix object instead of a boolean value.
Current:
awa(new Date() - 60 * 2000, true);
// => 2mDesired behavior
awa(new Date() - 60 * 2000, { short: true });
// => 2m
awa(new Date() - 60 * 2000, { short: false });
// => 2 minutes agoLicense
MIT License © Carlos Abraham
