Code Monkey home page Code Monkey logo

next-timeago's Introduction

next-timeago

React timeago component for your next React apps.

NPM JavaScript Style Guide

๐ŸŽ 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

import { useTimeAgo } from 'next-timeago';

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

  return (
    <>
      <TimeAgo date='July 1, 2023' locale='kh' />

      <TimeAgo date='July 1, 2023' locale='JA' />

      <TimeAgo date='July 1, 2023 9:00 pm' />

      <TimeAgo date='July 1, 2023 20:00' />
    </>
  );
}

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.

โ— 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

next-timeago's People

Contributors

bunlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

next-timeago's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.