https://github.com/miteshtagadiya/react-timesago
A component that takes a date as a prop and returns a time-span with live updating date.
https://github.com/miteshtagadiya/react-timesago
react-time-range react-timeago react-times time-spans timesago-react
Last synced: 12 months ago
JSON representation
A component that takes a date as a prop and returns a time-span with live updating date.
- Host: GitHub
- URL: https://github.com/miteshtagadiya/react-timesago
- Owner: miteshtagadiya
- License: mit
- Created: 2019-04-23T05:25:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T01:43:00.000Z (almost 2 years ago)
- Last Synced: 2024-04-23T03:51:44.628Z (almost 2 years ago)
- Topics: react-time-range, react-timeago, react-times, time-spans, timesago-react
- Language: JavaScript
- Homepage:
- Size: 478 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## React-TimesAgo
[](https://www.npmjs.com/package/react-timesago)
[](https://www.npmjs.com/package/react-timesago)
[](https://www.npmjs.com/package/react-timesago)

React-TimesAgo is a component that takes a date as a prop and returns a time-span with live updating date.
## Demo
[React-TimesAgo](https://miteshtagadiya.github.io/React-TimesAgo/)
## Installation
1. Install React-TimesAgo as a dependency
```markdown
# NPM
npm install react-timesago
```
2. Import the `react-timesago` module
```markdown
// ES6
import TimesAgo from "react-timesago";
```
## Example
```jsx
import TimesAgo from 'react-timesago';
render() {
// type default
// type default
// type facebook
}
```
## Props
These are all of the available props (and their default values) for the `` component.
```markdown
{
prefix: "",
suffix: "ago",
type: "default",
time: new Date(1551788578911 * 1000)
}
```
## Props Details
* `prefix` - formatter prefix for date, ignored for type facebook.
* `suffix` - formatter suffix for date, ignored for type facebook.
* `type` - types for date format (facebook or default)
* `time` - date.