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

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.

License

Notifications You must be signed in to change notification settings

RaddishIoW/React-RelativeTime

Repository files navigation

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

About

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.

Resources

License

Code of conduct

Stars

Watchers

Forks