mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Create app namespace for all absolute requires of app modules. Move all packages under packages yarn workspace
This commit is contained in:
20
packages/app/components/ui/RelativeTime.tsx
Normal file
20
packages/app/components/ui/RelativeTime.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import { FormattedRelativeTime } from 'react-intl';
|
||||
import { selectUnit } from '@formatjs/intl-utils';
|
||||
|
||||
function RelativeTime({ timestamp }: { timestamp: number }) {
|
||||
const { unit, value }: { unit: any; value: number } = selectUnit(timestamp);
|
||||
|
||||
return (
|
||||
<FormattedRelativeTime
|
||||
value={value}
|
||||
unit={unit}
|
||||
numeric="auto"
|
||||
updateIntervalInSeconds={
|
||||
['seconds', 'minute', 'hour'].includes(unit) ? 1 : undefined
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default RelativeTime;
|
Reference in New Issue
Block a user