All Projects → TylerLH → React Native Timeago

TylerLH / React Native Timeago

An auto-updating timeago component for React Native using moment.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Timeago

pholiday
a persian calendar holidays library for javascript
Stars: ✭ 38 (-88.79%)
Mutual labels:  moment
relative.time.parser
Moment.js Plugin for parsing Relative Time Strings
Stars: ✭ 13 (-96.17%)
Mutual labels:  moment
moment-cache
⏱ Simple utility to cache moment.js results and speed up moment calls.
Stars: ✭ 29 (-91.45%)
Mutual labels:  moment
scala-js-momentjs
Scala.js façade for Moment.js
Stars: ✭ 45 (-86.73%)
Mutual labels:  moment
format-date
📆 A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
Stars: ✭ 25 (-92.63%)
Mutual labels:  moment
imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-93.81%)
Mutual labels:  moment
Gisola
Gisola: A High Performance Computing application for real-time Moment Tensor inversion
Stars: ✭ 35 (-89.68%)
Mutual labels:  moment
dayjs
Extended fork of Day.js - 2KB immutable date library alternative to Moment.js
Stars: ✭ 36 (-89.38%)
Mutual labels:  moment
moment-recur-ts
Conversion of the moment-recur library into TypeScript.
Stars: ✭ 17 (-94.99%)
Mutual labels:  moment
react-native-daterange-picker
A React Native component for picking date ranges or single dates.
Stars: ✭ 86 (-74.63%)
Mutual labels:  moment
moment-element
Web Component (with Polymer) wrapper for the moment library
Stars: ✭ 15 (-95.58%)
Mutual labels:  moment
aestheticDialogs
📱 Flutter Plugin for 💫fluid, 😍beautiful, 🎨custom Dialogs
Stars: ✭ 19 (-94.4%)
Mutual labels:  moment
chronos
One library to rule the time
Stars: ✭ 17 (-94.99%)
Mutual labels:  moment
bs-moment
BuckleScript bindings for Moment.js
Stars: ✭ 56 (-83.48%)
Mutual labels:  moment
moment-dayjs-codemod
A Codemod to migrate from moment.js to day.js
Stars: ✭ 20 (-94.1%)
Mutual labels:  moment
movie-site
基于Nodejs+Express+MongoDB+jQuery+Bootstrap搭建的电影网站!
Stars: ✭ 48 (-85.84%)
Mutual labels:  moment
date-format
A reliable way to format dates and times in Elm.
Stars: ✭ 48 (-85.84%)
Mutual labels:  moment
moment-holiday
A Moment.js plugin for handling holidays. NO LONGER MAINTAINED (DEPRECATED)
Stars: ✭ 82 (-75.81%)
Mutual labels:  moment
ng2-timezone-selector
A simple Angular module to create a timezone selector using moment-timezone.
Stars: ✭ 12 (-96.46%)
Mutual labels:  moment
node-red-contrib-moment
Node-Red Node that produces formatted Date/Time output using the Moment.JS library. Timezone, dst and locale aware.
Stars: ✭ 31 (-90.86%)
Mutual labels:  moment

react-native-timeago

View package on npm npm Build status

An auto-updating timeago component for React Native using moment.js.

Usage

import React, { Component } from 'react';
import TimeAgo from 'react-native-timeago';

// Timestamp can be any valid data type accepted in a Moment.js constructor
// Currently accepts string, number, array, or a Date instance
let timestamp = "2015-06-21T06:24:44.124Z";

class MyComponent extends Component {

  ...

  render() {
    return (
      <TimeAgo time={timestamp} />
    )
  }

  ...
};

If you'd like to hide the string "ago" from the phrase returned, you can use the hideAgo prop:

<TimeAgo time={timestamp} hideAgo={true} />

All normal Text props are applicable (including style). Use the interval prop to change the update interval in milliseconds (default: 60000).

// This component would update every 20 seconds
<TimeAgo time={timestamp} interval={20000} />

Support local language

To support local language, you need to require locale language file, and call moment.locale() in your app. For example

let TimeAgo = require('react-native-timeago');

let moment = require('moment'); //load moment module to set local language
require('moment/locale/zh-cn'); //for import moment local language file during the application build
moment.locale('zh-cn');//set moment local language to zh-cn
...

Contributing

If you'd like to see something added or changed to this module please open a new GitHub issue. Pull requests are always welcome.

Author

Created and maintained by Tyler Hughes. Contributions by these fine folks.

License

Copyright (c) 2015-2018, Tyler Hughes [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].