move date formatting to a utility.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import type { ChangeEvent, FormEvent } from 'react';
|
||||
import type { Identifier } from '../../types/identifiers';
|
||||
import { formatDateTime } from '../../utils/date';
|
||||
|
||||
interface ApiTokenEntry {
|
||||
id?: Identifier;
|
||||
@@ -61,17 +62,6 @@ interface ApiTokensSectionProps {
|
||||
onRefreshCapabilities?: () => void;
|
||||
}
|
||||
|
||||
const formatDateTime = (value) => {
|
||||
if (!value) {
|
||||
return '—';
|
||||
}
|
||||
const timestamp = new Date(value);
|
||||
if (Number.isNaN(timestamp.getTime())) {
|
||||
return value;
|
||||
}
|
||||
return timestamp.toLocaleString();
|
||||
};
|
||||
|
||||
const ApiTokensSection = ({
|
||||
tokens = [],
|
||||
loading = false,
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import type { FormEvent } from 'react';
|
||||
import type { PasskeyRecord, RegisterPasskeyResult } from '../usePasskeys';
|
||||
|
||||
const formatDateTime = (value) => {
|
||||
if (!value) {
|
||||
return '—';
|
||||
}
|
||||
const timestamp = new Date(value);
|
||||
if (Number.isNaN(timestamp.getTime())) {
|
||||
return value;
|
||||
}
|
||||
return timestamp.toLocaleString();
|
||||
};
|
||||
import { formatDateTime } from '../../utils/date';
|
||||
|
||||
interface PasskeysSectionProps {
|
||||
passkeys?: PasskeyRecord[];
|
||||
|
||||
Reference in New Issue
Block a user