react-timestamp
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

React Timestamp

Render a nice looking time.

Usage

If you only provide a date then it will just format it nicely:

<Timestamp date={Date} /> // 26 Mar 2018, 10:30am

If you enable relative then you'll get something like:

<Timestamp relative date={Date} /> // 4 hours ago
<Timestamp relative date={Date} /> // in 4 hours
<Timestamp relative date={Date} relativeTo={Date} /> // 4 hours
<Timestamp relative date={Date} relativeTo={Date} /> // 2 years

<Timestamp relative date={Date} autoUpdate /> // 1 minute ago, 2 minutes ago, 3 minutes ago

Other options are set by passing an options prop:

<Timestamp date={Date} options={{ includeDay: true, twentyFourHour: true }} /> // Tuesday, 26 Mar 2018, 16:30

Authors

Package Sidebar

Install

npm i react-timestamp

Weekly Downloads

1,762

Version

6.0.0

License

MIT

Unpacked Size

7.75 kB

Total Files

7

Last publish

Collaborators

  • nathanhoad