🪢 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-date-range-in-picker (#375)
Max Deichmannf24b58703861
diff --git a/.vscode/launch.json b/.vscode/launch.jsonindex cbb9f4a4a0..ee3bdd72cb 100644--- a/.vscode/launch.json+++ b/.vscode/launch.json@@ -19,7 +19,7 @@"request": "launch","command": "npm run dev","serverReadyAction": {- "pattern": "started server on .+, url: (https?://.+)",+ "pattern": "- Local:.+(https?://.+)","uriFormat": "%s","action": "debugWithChrome"}diff --git a/src/components/date-picker.tsx b/src/components/date-picker.tsxindex cb415dbfc4..57dddfa5bd 100644--- a/src/components/date-picker.tsx+++ b/src/components/date-picker.tsx@@ -29,6 +29,7 @@ import {import { useMediaQuery } from "react-responsive";import { type DashboardDateRange } from "@/src/pages/project/[projectId]";import { isValidOption } from "@/src/utils/types";+import { setBeginningOfDay, setEndOfDay } from "@/src/utils/dates";export const DEFAULT_DATE_RANGE_SELECTION = "Select date range" as const;export type AvailableDateRangeSelections =@@ -119,12 +120,20 @@ export function DatePickerWithRange({};const onCalendarSelection = (range?: DateRange) => {- setInternalDateRange(range);- if (range && range.from && range.to) {- setDateRangeAndOption(DEFAULT_DATE_RANGE_SELECTION, {- from: range.from,- to: range.to,- });+ const newRange = range+ ? {+ from: range.from ? setBeginningOfDay(range.from) : undefined,+ to: range.to ? setEndOfDay(range.to) : undefined,+ }+ : undefined;++ setInternalDateRange(newRange);+ if (newRange && newRange.from && newRange.to) {+ const dashboardDateRange: DashboardDateRange = {+ from: newRange.from,+ to: newRange.to,+ };+ setDateRangeAndOption(DEFAULT_DATE_RANGE_SELECTION, dashboardDateRange);}};diff --git a/src/utils/dates.ts b/src/utils/dates.tsindex d22debf6dd..5231a88403 100644--- a/src/utils/dates.ts+++ b/src/utils/dates.ts@@ -4,3 +4,13 @@ export const utcDateOffsetByDays = (days: number) => {date.setUTCDate(date.getUTCDate() + days);return date;};++export const setBeginningOfDay = (date: Date) => {+ date.setHours(0, 0, 0, 0);+ return date;+};++export const setEndOfDay = (date: Date) => {+ date.setHours(23, 59, 59, 999);+ return date;+};