React timeago component for your next React apps.
npm install next-timeagoReact timeago component for your next React apps.
 
* No dependencies
* Compatible with both JavaScript and TypeScript
* Support for various languages
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
`ts
import { useTimeAgo } from 'next-timeago';
const Home = () => {
const { TimeAgo } = useTimeAgo();
return (
<>
>
);
}
export default Home;
`
| 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. |
| 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 |
Latest version 0.2.0 (2023-08-23):
* Upgrade dependencies
Details changes for each release are documented in the CHANGELOG.md.
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.
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
Bunlong |
The MIT License 