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.
npm install @raddishiow/react-relativetime --save
yarn add @raddishiow/react-relativetime
pnpm add @raddishiow/react-relativetime
...
import RelativeTime from '@raddishiow/react-relativetime'
...
const date = new Date(Date.now())
<RelativeTime time={date} />
Output:
in 0 seconds
Feel free to fork and create pull requests for features, fixes, etc.
Testing is via Jest and testing-library/react