diff --git a/frontend/src/pages/flows/flows.tsx b/frontend/src/pages/flows/flows.tsx
index 32d71678..3f270235 100644
--- a/frontend/src/pages/flows/flows.tsx
+++ b/frontend/src/pages/flows/flows.tsx
@@ -1,7 +1,5 @@
import type { ColumnDef } from '@tanstack/react-table';
-import { format, isToday } from 'date-fns';
-import { enUS } from 'date-fns/locale';
import { Ellipsis, Eye, GitFork, Loader2, Pause, Pencil, PencilLine, Plus, Star, Trash } from 'lucide-react';
import { CheckCircle2, XCircle } from 'lucide-react';
import { useCallback, useMemo, useRef, useState } from 'react';
@@ -33,6 +31,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
import { ResultType, StatusType, type TerminalFragmentFragment, useRenameFlowMutation } from '@/graphql/types';
import { useTableState } from '@/hooks/use-table-state';
import { mergeHrefWithSearchParams } from '@/lib/url-params';
+import { formatDate } from '@/lib/utils/format';
import { useFavorites } from '@/providers/favorites-provider';
import { type Flow, useFlows } from '@/providers/flows-provider';
@@ -62,22 +61,6 @@ const statusConfig: Record<
},
};
-const formatDateTime = (dateString: string) => {
- const date = new Date(dateString);
-
- if (isToday(date)) {
- return format(date, 'HH:mm:ss', { locale: enUS });
- }
-
- return format(date, 'd MMM yyyy', { locale: enUS });
-};
-
-const formatFullDateTime = (dateString: string) => {
- const date = new Date(dateString);
-
- return format(date, 'd MMM yyyy, HH:mm:ss', { locale: enUS });
-};
-
function Flows() {
const navigate = useNavigate();
const location = useLocation();
@@ -367,16 +350,7 @@ function Flows() {
cell: ({ row }) => {
const dateString = row.getValue('createdAt') as string;
- return (
-
-
- {formatDateTime(dateString)}
-
-
- {formatFullDateTime(dateString)}
-
-
- );
+ return
{formatDate(new Date(dateString))}
;
},
header: ({ column }) => (
{
const dateString = row.getValue('updatedAt') as string;
- return (
-
-
- {formatDateTime(dateString)}
-
-
- {formatFullDateTime(dateString)}
-
-
- );
+ return {formatDate(new Date(dateString))}
;
},
header: ({ column }) => (
{
- const date = new Date(dateString);
-
- if (isToday(date)) {
- return format(date, 'HH:mm:ss', { locale: enUS });
- }
-
- return format(date, 'd MMM yyyy', { locale: enUS });
-};
-
-const formatFullDateTime = (dateString: string) => {
- const date = new Date(dateString);
-
- return format(date, 'd MMM yyyy, HH:mm:ss', { locale: enUS });
-};
-
const calculateTTL = (expiresAt: Date): number => {
const now = new Date();
const diffMs = expiresAt.getTime() - now.getTime();
@@ -673,16 +657,7 @@ function SettingsAPITokens() {
const expiresAt = getTokenExpirationDate(token);
const expiresAtString = expiresAt.toISOString();
- return (
-
-
- {formatDateTime(expiresAtString)}
-
-
- {formatFullDateTime(expiresAtString)}
-
-
- );
+ return {formatDate(new Date(expiresAtString))}
;
},
header: ({ column }) => (
-
- {formatDateTime(dateString)}
-
-
- {formatFullDateTime(dateString)}
-
-
- );
+ return {formatDate(new Date(dateString))}
;
},
header: ({ column }) => (
> = {
@@ -63,22 +61,6 @@ const providerTypes = [
{ label: 'Qwen', type: ProviderType.Qwen },
];
-const formatDateTime = (dateString: string) => {
- const date = new Date(dateString);
-
- if (isToday(date)) {
- return format(date, 'HH:mm:ss', { locale: enUS });
- }
-
- return format(date, 'd MMM yyyy', { locale: enUS });
-};
-
-const formatFullDateTime = (dateString: string) => {
- const date = new Date(dateString);
-
- return format(date, 'd MMM yyyy, HH:mm:ss', { locale: enUS });
-};
-
function SettingsProviders() {
const { data, error, loading: isLoading } = useSettingsProvidersQuery();
const [deleteProvider, { error: deleteError, loading: isDeleteLoading }] = useDeleteProviderMutation();
@@ -179,16 +161,7 @@ function SettingsProviders() {
cell: ({ row }) => {
const dateString = row.getValue('createdAt') as string;
- return (
-
-
- {formatDateTime(dateString)}
-
-
- {formatFullDateTime(dateString)}
-
-
- );
+ return {formatDate(new Date(dateString))}
;
},
header: ({ column }) => (
{
const dateString = row.getValue('updatedAt') as string;
- return (
-
-
- {formatDateTime(dateString)}
-
-
- {formatFullDateTime(dateString)}
-
-
- );
+ return {formatDate(new Date(dateString))}
;
},
header: ({ column }) => (