Description
timeago-react is a small React component that shows a date as relative time, such as '3 hours ago'. It is built on the timeago.js module and is about 2 KB. You pass it a date as a string, a Date object or a timestamp, and it renders a span with the relative time. By default the text updates live, and the component releases its timer when it unmounts. An optional relative date lets you compute the difference from a point other than now, and a minimum interval controls how often the text refreshes. The default locale is English, and other locales are supported once you import them, with the README listing those available. The component passes extra props to the root element, so you can style it with class names or a style object. The library is released under the MIT license, and it is an npm package, installed with npm install timeago-react.…
Highlights
- Shows dates as relative time such as '3 hours ago'
- Updates live and cleans up its timer
- Accepts strings, Date objects or timestamps
- Supports multiple locales
- About 2 KB, MIT licensed
Ratings & Reviews
No ratings yet
Be the first to rate timeago-react.
People also visit

react-relative-time
React Component for rendering relative dates as <time> HTML5 elements
timeago-react FAQ
What is timeago-react?
A React component that displays a date as a relative time statement, such as '3 hours ago'.
How do I install it?
Run npm install timeago-react, then render the component with a datetime prop.
What date formats does it accept?
The datetime prop accepts a datetime string, a Date instance or a timestamp.
Does the text update over time?
Yes. By default the component is live, and the text refreshes as time passes.
Can I change the language?
Yes. Set the locale prop, and import any locale other than the default English and Simplified Chinese before using it.
Is it free to use?
The project is released under the MIT license.
What are the best timeago-react alternatives?
Popular alternatives to timeago-react include react-timeago, react-relative-time and react-moment. See all timeago-react alternatives
















