date-strings

1.2.5 • Public • Published

date-strings

Simple zero dependancy client or server package for finding out how long ago in English a Date object was.

import ds from 'date-strings';

const date = new Date('2017-09-01T09:54:05.216Z');
const dateString = ds(date);

const response = `Event took place on ${dateString.when}, ${dateString.ago.strings.long} ago`;
// Event took place on 1 Sep 10:54, 4 weeks 1 day

build

Date Strings is written in modern es7, but uses babel to transpile npm build

tests

npm test

Readme

Keywords

Package Sidebar

Install

npm i date-strings

Weekly Downloads

2

Version

1.2.5

License

MIT

Unpacked Size

29.3 kB

Total Files

9

Last publish

Collaborators

  • danm