mirror of
https://github.com/diced/zipline.git
synced 2026-01-27 15:24:55 -08:00
20 lines
414 B
TypeScript
Executable File
20 lines
414 B
TypeScript
Executable File
import { relativeTime } from '@/lib/relativeTime';
|
|
import { Tooltip } from '@mantine/core';
|
|
|
|
export default function RelativeDate({
|
|
date,
|
|
from,
|
|
}: {
|
|
date: Date | string | number;
|
|
from?: Date | string | number;
|
|
}) {
|
|
const d = new Date(date);
|
|
const f = from ? new Date(from) : new Date();
|
|
|
|
return (
|
|
<Tooltip label={d.toLocaleString()}>
|
|
<span>{relativeTime(d, f)}</span>
|
|
</Tooltip>
|
|
);
|
|
}
|