A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/hustcc/timeago-react below:

hustcc/timeago-react: :clock8: Simple and efficient react component to format date with `*** time ago` statement. eg: '3 hours ago'.

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 which is a simple javascript module.

npm install timeago-react

import * as React from 'react';
import TimeAgo from 'timeago-react'; // var TimeAgo = require('timeago-react');

<TimeAgo
  datetime={'2016-08-08 08:08:08'}
  locale='zh_CN'
/>

The datetime to be formatted. can be datetime string, Date instance, or timestamp.

Live render, default is true.

The class of span. you can setting the css style of span by class name.

The datetime to be calculated interval relative to.

The min interval in seconds to update the ** time ago string

The locale language of statement, default is en. All supported locales here. If you want to use locale which is not zh_CN / en, you should import the locale before use it. As below:

import * as React from 'react';
import TimeAgo from 'timeago-react';
import * as timeago from 'timeago.js';

// import it first.
import vi from 'timeago.js/lib/lang/vi';

// register it.
timeago.register('vi', vi);

// then use it.
<TimeAgo
  datetime={'2016-08-08 08:08:08'}
  locale='vi'
/>

The style object to applied to the root element.

Props not documented above are applied to the root element.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4