Files
liqa/client/src/ui/Timestamp/Timestamp.tsx
T
ars9 32beec2229 feat(client): add Timestamp component, ESLint 10 + Prettier, and code quality fixes
- add Timestamp component with moment relative time and ISO tooltip
- add Timestamp stories (JustNow, MinutesAgo, HoursAgo, DaysAgo, MonthsAgo)
- add ESLint 10 with typescript-eslint, react-hooks, react-refresh, prettier
- add Prettier config with singleQuote, semi, trailingComma all, printWidth 100
- add lint, lint:fix, format, test:storybook scripts to package.json
- fix react-hooks/set-state-in-effect in all page components
- auto-fix 113 Prettier formatting issues across src and .storybook
2026-04-09 10:25:15 +03:00

19 lines
407 B
TypeScript

import moment from 'moment';
import styles from './Timestamp.module.css';
export interface TimestampProps {
value: string | number | Date;
}
export function Timestamp({ value }: TimestampProps) {
const m = moment(value);
const iso = m.toISOString();
const relative = m.fromNow();
return (
<span className={styles.timestamp} title={iso} aria-label={iso}>
{relative}
</span>
);
}