# timeago-react **Repository Path**: hustcc/timeago-react ## Basic Information - **Project Name**: timeago-react - **Description**: :clock8: Simple and efficient react component to format date with `*** time ago` statement. eg: '3 hours ago'. - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: http://git.hust.cc/timeago-react/ - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2016-10-24 - **Last Updated**: 2023-05-02 ## Categories & Tags **Categories**: react-extensions **Tags**: None ## README # timeago-react > timeago-react is a simple react component used to format date with `*** time ago` statement. eg: '3 hours ago'. **The component based on [timeago.js](https://github.com/hustcc/timeago.js)** which is a simple javascript module. - Realtime render. Automatic release the resources. - Simple. Only 2kb. - Efficient. When the time is `3 hour ago`, the interval will an hour (3600 * 1000 ms). - Locales supported. [![Build Status](https://travis-ci.org/hustcc/timeago-react.svg?branch=master)](https://travis-ci.org/hustcc/timeago-react) [![npm](https://img.shields.io/npm/v/timeago-react.svg?style=flat-square)](https://www.npmjs.com/package/timeago-react) [![npm](https://img.shields.io/npm/dt/timeago-react.svg?style=flat-square)](https://www.npmjs.com/package/timeago-react) [![npm](https://img.shields.io/npm/l/timeago-react.svg?style=flat-square)](https://www.npmjs.com/package/timeago-react) # 1. install > **npm install timeago-react** # 2. usage ```js import React from 'react'; import TimeAgo from 'timeago-react'; // var TimeAgo = require('timeago-react'); ``` # 3. component props - **`datetime`** (required, string / Date / timestamp) The datetime to be formated. can be `datetime string`, `Date instance`, or `timestamp`. - **`live`** (optional, boolean) Live render, default is `true`. - **`className`** (optional, string) The `class` of span. you can setting the css style of span by class name. - **`locale`** (optional, string) The `locale` language of statement, default is `en`. All supported locales [here](https://github.com/hustcc/timeago.js/tree/master/locales). # 4. LICENSE MIT