Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Bunlong/next-timeago

React timeago component for your next React apps.
https://github.com/Bunlong/next-timeago

gatsby-plugins gatsbyjs next next-plugins next-timeago nextjs react react-timeago reactjs timeago timeagojs

Last synced: 6 days ago
JSON representation

React timeago component for your next React apps.

Awesome Lists containing this project

README

        

# next-timeago

React timeago component for your next React apps.

[![NPM](https://img.shields.io/npm/v/next-timeago.svg)](https://www.npmjs.com/package/next-timeago) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## 🎁 Features

* No dependencies
* Compatible with both JavaScript and TypeScript
* Support for various languages

## 🔧 Install

next-timeago is available on npm. It can be installed with the following command:

```
npm install next-timeago --save
```

next-timeago is available on yarn as well. It can be installed with the following command:

```
yarn add next-timeago --save
```

## 💡 Usage

```ts
import { useTimeAgo } from 'next-timeago';

const Home = () => {
const { TimeAgo } = useTimeAgo();

return (
<>


>
);
}

export default Home;
```

## Props



Prop
Type
Default
Require
Description




date
string | number | Date

✔️
A date in the past.


locale
string
en

Support for various languages.


live
boolean
true

Live by default and will auto update it's value.


element
string | React.ElementType
time

HTML tag that is used to wrap the live updating string.

### List of Locale Codes



Language Name
Code




Afrikaans
af


Arabic
ar


Azerbaijani
az


Azerbaijani shortened
az-short


Belarusian
be


Bulgarian
bg


Bosnian
bs


Catalan
ca


Czech
cs


Welsh
cy


Danish
da


German
de


German shortened
de-short


Divehi, Dhivehi, Maldivian
dv


Greek
el


English
en


English shortened
en-short


Spanish
es


Spanish shortened
es-short


Estonian
et


Basque
eu


Persian
fa


Persian shortened
fa-short


Finnish
fi


French
fr


French shortened
fr-short


Galician
gl


Hebrew
he


Hindi
hi


Croatian
hr


Hungarian
hu


Armenian
hy


Indonesian
id


Icelandic
is


Italian
it


Italian shortened
it-short


Japanese
ja


Javanesse
jv


Georgian
jv


Georgian shortened
ka-short


Khmer
kh


Korean
ko


Russian
ky


Lithuanian
lt


Latvian
lv


Macedonian
mk


Dutch
nl


Norwegian
no


Catalan
oc


Polish
pl


Portuguese
pt


Brazilian Portuguese
pt-br


Portuguese Brasil shortened
pt-br-short


Portuguese shortened
pt-short


Romanian
ro


Serbian
rs


Russian
ru


Kinyarwanda
rw


Sinhalese
si


Slovak
sk


Slovenian with support for dual
sl


Somali
so


Serbian
sr


Swedish
sv


Tamil
ta


Thai
th


Turkish
tr


Turkish shortened
tr-short


Ukrainian
uk


Uzbek
uz


Vietnamese
vi


Simplified Chinese
zh-CN


Traditional Chinese, zh-tw
zh-TW

## 📜 Changelog

Latest version 0.2.0 (2023-08-23):

* Upgrade dependencies

Details changes for each release are documented in the [CHANGELOG.md](https://github.com/Bunlong/next-timeago/blob/master/CHANGELOG.md).

## ❗ Issues

If you think any of the `next-timeago` can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

## 💪 Contribution

We'd love to have your helping hand on contributions to `next-timeago` by forking and sending a pull request!

Your contributions are heartily ♡ welcome, recognized and appreciated. (✿◠‿◠)

How to contribute:

- Open pull request with improvements
- Discuss ideas in issues
- Spread the word
- Reach out with any feedback

## 🏆 Contributors




Bunlong



Bunlong



## ⚖️ License

The MIT License [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)