Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Latest commit

 

History

History
42 lines (27 loc) · 1.04 KB

README.md

File metadata and controls

42 lines (27 loc) · 1.04 KB

React-RelativeTime

React-RelativeTime is an extremely simple React Component which takes a JSDate and returns a string representation of the time relative to now. It updates this time once a minute.

The relative time strings are provided by Luxon, so include a lot of translations built-in.

Installation

NPM

npm install @raddishiow/react-relativetime --save

Yarn

yarn add @raddishiow/react-relativetime

PNPM

pnpm add @raddishiow/react-relativetime

Usage

...
import RelativeTime from '@raddishiow/react-relativetime'
...

const date = new Date(Date.now())

<RelativeTime time={date} />

Output: in 0 seconds

Contributing

Feel free to fork and create pull requests for features, fixes, etc.

Testing

Testing is via Jest and testing-library/react

JavaScript Style Guide

Types: Typescript