mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Fixed triggered event lookup. Closes #3742.
This commit is contained in:
parent
cc8254985b
commit
cb63e49a9b
4 changed files with 16 additions and 9 deletions
|
|
@ -1,13 +1,18 @@
|
|||
import { Text } from '@umami/react-zen';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { useLocale, useTimezone } from '@/components/hooks';
|
||||
import { isInvalidDate } from '@/lib/date';
|
||||
|
||||
export function DateDistance({ date }: { date: Date }) {
|
||||
const { formatTimezoneDate } = useTimezone();
|
||||
const { dateLocale } = useLocale();
|
||||
|
||||
if (!isInvalidDate(date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Text title={formatTimezoneDate(date.toISOString(), 'PPPpp')}>
|
||||
<Text title={formatTimezoneDate(date?.toISOString(), 'PPPpp')}>
|
||||
{formatDistanceToNow(date, { addSuffix: true, locale: dateLocale })}
|
||||
</Text>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue