🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(ui): utc startDate in model form (#2532)
Marc Klingenc97ffde5981d
diff --git a/web/src/features/models/components/NewModelForm.tsx b/web/src/features/models/components/NewModelForm.tsxindex f018861051..2835f875b5 100644--- a/web/src/features/models/components/NewModelForm.tsx+++ b/web/src/features/models/components/NewModelForm.tsx@@ -29,6 +29,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import { JsonEditor } from "@/src/components/json-editor";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import Link from "next/link";+import { utcDate } from "@/src/utils/dates";const formSchema = z.object({modelName: z.string().min(1),@@ -124,6 +125,7 @@ export const NewModelForm = (props: {typeof JSON.parse(values.tokenizerConfig) === "object"? (JSON.parse(values.tokenizerConfig) as Record<string, number>): undefined,+ startDate: values.startDate ? utcDate(values.startDate) : undefined,}).then(() => {props.onFormSuccess?.();diff --git a/web/src/utils/dates.ts b/web/src/utils/dates.tsindex 1755afe190..9d09d07dae 100644--- a/web/src/utils/dates.ts+++ b/web/src/utils/dates.ts@@ -5,6 +5,15 @@ export const utcDateOffsetByDays = (days: number) => {return date;};+export const utcDate = (localDateTime: Date) =>+ new Date(+ Date.UTC(+ localDateTime.getFullYear(),+ localDateTime.getMonth(),+ localDateTime.getDate(),+ ),+ );+export const setBeginningOfDay = (date: Date) => {date.setHours(0, 0, 0, 0);return date;