mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix TimeCellProps
This commit is contained in:
parent
d8774bb53d
commit
2734fac591
2 changed files with 40 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import React from "react";
|
|||
import { CountryCell } from "./country_cell";
|
||||
import { getProviderLogoAndName } from "../provider_info_helpers";
|
||||
import { Tooltip } from "antd";
|
||||
import { TimeCell } from "./time_cell";
|
||||
|
||||
export type LogEntry = {
|
||||
request_id: string;
|
||||
|
|
@ -53,9 +54,7 @@ export const columns: ColumnDef<LogEntry>[] = [
|
|||
{
|
||||
header: "Time",
|
||||
accessorKey: "startTime",
|
||||
cell: (info: any) => (
|
||||
<span>{moment(info.getValue()).format("MMM DD HH:mm:ss")}</span>
|
||||
),
|
||||
cell: (info: any) => <TimeCell utcTime={info.getValue()} />,
|
||||
},
|
||||
{
|
||||
header: "Request ID",
|
||||
|
|
|
|||
38
ui/litellm-dashboard/src/components/view_logs/time_cell.tsx
Normal file
38
ui/litellm-dashboard/src/components/view_logs/time_cell.tsx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import * as React from "react";
|
||||
|
||||
interface TimeCellProps {
|
||||
utcTime: string;
|
||||
}
|
||||
|
||||
const getLocalTime = (utcTime: string): string => {
|
||||
try {
|
||||
const date = new Date(utcTime);
|
||||
return date.toLocaleString('en-US', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hour12: true
|
||||
}).replace(',', '');
|
||||
} catch (e) {
|
||||
return "Error converting time";
|
||||
}
|
||||
};
|
||||
|
||||
export const TimeCell: React.FC<TimeCellProps> = ({ utcTime }) => {
|
||||
return (
|
||||
<span style={{
|
||||
fontFamily: 'monospace',
|
||||
width: '180px',
|
||||
display: 'inline-block'
|
||||
}}>
|
||||
{getLocalTime(utcTime)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export const getTimeZone = (): string => {
|
||||
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue