mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Created formatDate function for rendering dates in correct timezone.
This commit is contained in:
parent
b11b2e3524
commit
9b005e11c0
3 changed files with 12 additions and 19 deletions
|
|
@ -1,14 +1,12 @@
|
|||
import { GridTable, GridColumn, Icon } from 'react-basics';
|
||||
import { useLocale, useMessages, useTeamUrl, useTimezone } from 'components/hooks';
|
||||
import { useMessages, useTeamUrl, useTimezone } from 'components/hooks';
|
||||
import Empty from 'components/common/Empty';
|
||||
import Avatar from 'components/common/Avatar';
|
||||
import Link from 'next/link';
|
||||
import Icons from 'components/icons';
|
||||
import { formatInTimeZone } from 'date-fns-tz';
|
||||
|
||||
export function EventsTable({ data = [] }) {
|
||||
const { dateLocale } = useLocale();
|
||||
const { timezone } = useTimezone();
|
||||
const { formatDate } = useTimezone();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { renderTeamUrl } = useTeamUrl();
|
||||
|
||||
|
|
@ -37,11 +35,7 @@ export function EventsTable({ data = [] }) {
|
|||
}}
|
||||
</GridColumn>
|
||||
<GridColumn name="created" label={formatMessage(labels.created)} width={'300px'}>
|
||||
{row =>
|
||||
formatInTimeZone(new Date(row.createdAt.split(' ').join('T') + 'Z'), timezone, 'PPPpp', {
|
||||
locale: dateLocale,
|
||||
})
|
||||
}
|
||||
{row => formatDate(row.createdAt, 'PPPpp')}
|
||||
</GridColumn>
|
||||
</GridTable>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue