The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
tz progress
ddux0c852bcfb1ee
diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex e5a1d8c1..317468eb 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -9,6 +9,7 @@"version": "0.0.1","dependencies": {"lucide-svelte": "^0.562.0",+ "luxon": "^3.7.2","svelte-highlight": "^7.9.0"},"devDependencies": {@@ -24,6 +25,7 @@"@types/d3-array": "^3.2.2","@types/d3-scale": "^4.0.9","@types/d3-shape": "^3.1.7",+ "@types/luxon": "^3.7.1","@types/node": "^22","bits-ui": "^2.14.4","clsx": "^2.1.1",@@ -1716,6 +1718,13 @@"dev": true,"license": "MIT"},+ "node_modules/@types/luxon": {+ "version": "3.7.1",+ "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.7.1.tgz",+ "integrity": "sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/node": {"version": "22.19.3","resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz",@@ -3666,6 +3675,15 @@"svelte": "^3 || ^4 || ^5.0.0-next.42"}},+ "node_modules/luxon": {+ "version": "3.7.2",+ "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz",+ "integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/lz-string": {"version": "1.5.0","resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",diff --git a/frontend/package.json b/frontend/package.jsonindex 63eeacea..68e0adfe 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -26,6 +26,7 @@"@types/d3-array": "^3.2.2","@types/d3-scale": "^4.0.9","@types/d3-shape": "^3.1.7",+ "@types/luxon": "^3.7.1","@types/node": "^22","bits-ui": "^2.14.4","clsx": "^2.1.1",@@ -53,6 +54,7 @@},"dependencies": {"lucide-svelte": "^0.562.0",+ "luxon": "^3.7.2","svelte-highlight": "^7.9.0"}}diff --git a/frontend/src/lib/components/dashboard/metric-chart-overlay.svelte b/frontend/src/lib/components/dashboard/metric-chart-overlay.svelteindex e7bcda1a..0ba30785 100644--- a/frontend/src/lib/components/dashboard/metric-chart-overlay.svelte+++ b/frontend/src/lib/components/dashboard/metric-chart-overlay.svelte@@ -1,5 +1,7 @@<script lang="ts">import type { Snippet } from 'svelte';+ import { formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';type DataPoint = {timestamp: Date;@@ -14,7 +16,8 @@chartPadding = { left: 20, right: 4 },data = [],unit = '',- formatValue+ formatValue,+ timezone} = $props<{fromTime: Date;toTime: Date;@@ -24,8 +27,11 @@data?: DataPoint[];unit?: string;formatValue?: (value: number) => string;+ timezone?: string;}>();+ const tz = $derived(timezone ?? getTimezone());+let containerRef = $state<HTMLDivElement | null>(null);let isHovering = $state(false);let mouseX = $state(0);@@ -226,7 +232,7 @@// Format time for displayfunction formatTime(date: Date | null): string {if (!date) return '';- return date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });+ return formatDateTime(date, { timezone: tz, format: 'time' });}</script>diff --git a/frontend/src/lib/components/issue-trend-chart.svelte b/frontend/src/lib/components/issue-trend-chart.svelteindex c1294a21..bb501b46 100644--- a/frontend/src/lib/components/issue-trend-chart.svelte+++ b/frontend/src/lib/components/issue-trend-chart.svelte@@ -1,19 +1,24 @@<script lang="ts">import * as Tooltip from "$lib/components/ui/tooltip";+ import { formatDateTime, getNow } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';type TrendPoint = { timestamp: string; count: number };- let { trend = [] }: {+ let { trend = [], timezone }: {trend: TrendPoint[];+ timezone?: string;} = $props();+ const tz = $derived(timezone ?? getTimezone());+// Always 24 hoursconst HOURS = 24;const SCALE_MAX = 10; // Visual scale max - bars are relative to this// Build 24-hour data array, filling gaps with 0const hourlyData = $derived(() => {- const now = new Date();+ const nowDt = getNow(tz);const result: { hour: Date; count: number }[] = [];// Create a map of hour -> count from trend data@@ -26,9 +31,8 @@// Generate last 24 hoursfor (let i = HOURS - 1; i >= 0; i--) {- const hour = new Date(now);- hour.setMinutes(0, 0, 0);- hour.setHours(hour.getHours() - i);+ const hourDt = nowDt.minus({ hours: i }).startOf('hour');+ const hour = hourDt.toJSDate();const key = `${hour.getFullYear()}-${hour.getMonth()}-${hour.getDate()}-${hour.getHours()}`;result.push({hour,@@ -90,14 +94,7 @@<Tooltip.Content side="top" class="py-2 px-3 !animate-none !transition-none"><div class="font-medium text-sm">{point.count} {point.count === 1 ? 'Event' : 'Events'}</div><div class="text-muted-foreground text-xs">- {point.hour.toLocaleString(undefined, {- month: 'short',- day: 'numeric',- year: 'numeric',- hour: 'numeric',- minute: '2-digit',- timeZoneName: 'short'- })}+ {formatDateTime(point.hour, { timezone: tz, format: 'full' })}</div></Tooltip.Content></Tooltip.Root>diff --git a/frontend/src/lib/components/issues/event-card.svelte b/frontend/src/lib/components/issues/event-card.svelteindex cb013842..0ee46a1d 100644--- a/frontend/src/lib/components/issues/event-card.svelte+++ b/frontend/src/lib/components/issues/event-card.svelte@@ -4,7 +4,8 @@import * as Card from "$lib/components/ui/card";import { ArrowRight } from "lucide-svelte";import type { ExceptionOccurrence, LinkedTransaction } from '$lib/types/exceptions';- import { formatDuration, getStatusColor } from '$lib/utils/formatters';+ import { formatDuration, getStatusColor, formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import { ContextGrid } from '$lib/components/ui/context-grid';interface Props {@@ -12,15 +13,18 @@linkedTransaction: LinkedTransaction | null;title?: string;description?: string;+ timezone?: string;}let {occurrence,linkedTransaction,title = "Event",- description = "Details for this specific occurrence"+ description = "Details for this specific occurrence",+ timezone}: Props = $props();+ const tz = $derived(timezone ?? getTimezone());</script><Card.Root>@@ -33,7 +37,7 @@<div class="grid grid-cols-2 gap-4 md:grid-cols-4"><div class="space-y-1"><p class="text-sm text-muted-foreground">Recorded At</p>- <p class="font-mono text-sm">{new Date(occurrence.recordedAt).toLocaleString()}</p>+ <p class="font-mono text-sm">{formatDateTime(occurrence.recordedAt, { timezone: tz })}</p></div><div class="space-y-1"><p class="text-sm text-muted-foreground">Server</p>@@ -78,7 +82,7 @@</div><div class="space-y-1"><p class="text-sm text-muted-foreground">Recorded</p>- <p class="font-mono text-sm">{new Date(linkedTransaction.recordedAt).toLocaleString()}</p>+ <p class="font-mono text-sm">{formatDateTime(linkedTransaction.recordedAt, { timezone: tz })}</p></div></div><Button variant="outline" size="sm" onclick={() => goto(`/transactions/${encodeURIComponent(linkedTransaction.endpoint)}/${linkedTransaction.id}?preset=24h`)}>diff --git a/frontend/src/lib/components/issues/events-table.svelte b/frontend/src/lib/components/issues/events-table.svelteindex f76ed73d..e151b1a2 100644--- a/frontend/src/lib/components/issues/events-table.svelte+++ b/frontend/src/lib/components/issues/events-table.svelte@@ -6,6 +6,8 @@import { TableEmptyState } from "$lib/components/ui/table-empty-state";import { ViewAllTableRow } from "$lib/components/ui/view-all-table-row";import type { ExceptionOccurrence } from '$lib/types/exceptions';+ import { formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';interface Props {occurrences: ExceptionOccurrence[];@@ -14,6 +16,7 @@hasMore?: boolean;showViewAll?: boolean;currentRecordedAt?: string;+ timezone?: string;}let {@@ -22,9 +25,12 @@total,hasMore = false,showViewAll = true,- currentRecordedAt+ currentRecordedAt,+ timezone}: Props = $props();+ const tz = $derived(timezone ?? getTimezone());+function getRowUrl(occurrence: ExceptionOccurrence): string {return `/issues/${exceptionHash}/${encodeURIComponent(occurrence.recordedAt)}`;}@@ -70,7 +76,7 @@onclick={createRowClickHandler(getRowUrl(occurrence))}><Table.Cell>- {new Date(occurrence.recordedAt).toLocaleString()}+ {formatDateTime(occurrence.recordedAt, { timezone: tz })}{#if isCurrentEvent(occurrence)}<span class="ml-2 text-xs text-muted-foreground">(current)</span>{/if}diff --git a/frontend/src/lib/components/issues/stack-trace-card.svelte b/frontend/src/lib/components/issues/stack-trace-card.svelteindex ad9092f0..28333953 100644--- a/frontend/src/lib/components/issues/stack-trace-card.svelte+++ b/frontend/src/lib/components/issues/stack-trace-card.svelte@@ -1,5 +1,7 @@<script lang="ts">import * as Card from "$lib/components/ui/card";+ import { formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';interface Props {stackTrace: string;@@ -7,10 +9,12 @@firstSeen?: string;lastSeen?: string;totalCount?: number;+ timezone?: string;}- let { stackTrace, isMessage = false, firstSeen, lastSeen, totalCount }: Props = $props();+ let { stackTrace, isMessage = false, firstSeen, lastSeen, totalCount, timezone }: Props = $props();+ const tz = $derived(timezone ?? getTimezone());const showStats = $derived(firstSeen && lastSeen && totalCount !== undefined);</script>@@ -26,8 +30,8 @@</div>{#if showStats}<Card.Description>- First seen: {new Date(firstSeen!).toLocaleString()} ·- Last seen: {new Date(lastSeen!).toLocaleString()} ·+ First seen: {formatDateTime(firstSeen!, { timezone: tz })} ·+ Last seen: {formatDateTime(lastSeen!, { timezone: tz })} ·Total occurrences: {totalCount}</Card.Description>{/if}diff --git a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelteindex 2c16d18f..4687b82e 100644--- a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte+++ b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte@@ -4,6 +4,8 @@import * as Popover from "$lib/components/ui/popover";import { Clock, ChevronDown, ChevronRight, Check } from "@lucide/svelte";import { CalendarDate, CalendarDateTime, getLocalTimeZone, today } from "@internationalized/date";+ import { getNow, luxonToCalendarDateTime } from "$lib/utils/formatters";+ import { getTimezone } from "$lib/state/timezone.svelte";type TimeRangePreset = {value: string;@@ -21,6 +23,7 @@fromTime?: string;toTime?: string;preset?: string | null;+ timezone?: string;onApply?: (from: { date: CalendarDate; time: string }, to: { date: CalendarDate; time: string }, preset: string | null) => void;}@@ -30,9 +33,12 @@fromTime = $bindable('00:00'),toTime = $bindable('23:59'),preset = $bindable<string | null>('6h'),+ timezone,onApply}: Props = $props();+ const tz = $derived(timezone ?? getTimezone());+// Preset groupsconst presetGroups: PresetGroup[] = [{@@ -80,24 +86,26 @@if (preset) {const presetDef = presetGroups.flatMap(g => g.presets).find(p => p.value === preset);if (presetDef) {- const now = new Date();- const fromDateTime = new Date(now.getTime() - presetDef.minutes * 60 * 1000);+ const now = getNow(tz);+ const fromDt = now.minus({ minutes: presetDef.minutes });+ const fromParts = luxonToCalendarDateTime(fromDt);+ const toParts = luxonToCalendarDateTime(now);tempFromDateTime = new CalendarDateTime(- fromDateTime.getFullYear(),- fromDateTime.getMonth() + 1,- fromDateTime.getDate(),- fromDateTime.getHours(),- fromDateTime.getMinutes(),- fromDateTime.getSeconds()+ fromParts.year,+ fromParts.month,+ fromParts.day,+ fromParts.hour,+ fromParts.minute,+ fromParts.second);tempToDateTime = new CalendarDateTime(- now.getFullYear(),- now.getMonth() + 1,- now.getDate(),- now.getHours(),- now.getMinutes(),- now.getSeconds()+ toParts.year,+ toParts.month,+ toParts.day,+ toParts.hour,+ toParts.minute,+ toParts.second);}}@@ -218,26 +226,28 @@preset = presetDef.value; // Sync with external propshowCustom = false;- // Calculate the date range for this preset- const now = new Date();- const fromDateTime = new Date(now.getTime() - presetDef.minutes * 60 * 1000);+ // Calculate the date range for this preset using Luxon+ const now = getNow(tz);+ const fromDt = now.minus({ minutes: presetDef.minutes });+ const fromParts = luxonToCalendarDateTime(fromDt);+ const toParts = luxonToCalendarDateTime(now);// Update temp values only - don't close or apply yettempFromDateTime = new CalendarDateTime(- fromDateTime.getFullYear(),- fromDateTime.getMonth() + 1,- fromDateTime.getDate(),- fromDateTime.getHours(),- fromDateTime.getMinutes(),- fromDateTime.getSeconds()+ fromParts.year,+ fromParts.month,+ fromParts.day,+ fromParts.hour,+ fromParts.minute,+ fromParts.second);tempToDateTime = new CalendarDateTime(- now.getFullYear(),- now.getMonth() + 1,- now.getDate(),- now.getHours(),- now.getMinutes(),- now.getSeconds()+ toParts.year,+ toParts.month,+ toParts.day,+ toParts.hour,+ toParts.minute,+ toParts.second);}@@ -250,10 +260,11 @@}function resetToNow() {- const now = new Date();+ const now = getNow(tz);+ const nowParts = luxonToCalendarDateTime(now);tempToDateTime = new CalendarDateTime(- now.getFullYear(), now.getMonth() + 1, now.getDate(),- now.getHours(), now.getMinutes(), now.getSeconds()+ nowParts.year, nowParts.month, nowParts.day,+ nowParts.hour, nowParts.minute, nowParts.second);}diff --git a/frontend/src/lib/state/timezone.svelte.ts b/frontend/src/lib/state/timezone.svelte.tsnew file mode 100644index 00000000..e5001b83--- /dev/null+++ b/frontend/src/lib/state/timezone.svelte.ts@@ -0,0 +1,21 @@+import { DateTime } from 'luxon';++export const timezoneState = $state({+ timezone: ''+});++export function initTimezone() {+ if (typeof window !== 'undefined') {+ const stored = localStorage.getItem('timezone');+ timezoneState.timezone = stored || DateTime.local().zoneName || 'UTC';+ }+}++export function getTimezone(): string {+ return timezoneState.timezone || DateTime.local().zoneName || 'UTC';+}++export function setTimezone(tz: string) {+ timezoneState.timezone = tz;+ localStorage.setItem('timezone', tz);+}diff --git a/frontend/src/lib/utils/formatters.ts b/frontend/src/lib/utils/formatters.tsindex 4eccd515..65364b64 100644--- a/frontend/src/lib/utils/formatters.ts+++ b/frontend/src/lib/utils/formatters.ts@@ -1,3 +1,6 @@+import { DateTime } from 'luxon';+import { getTimezone } from '$lib/state/timezone.svelte';+export function formatDuration(nanoseconds: number): string {const ms = nanoseconds / 1_000_000;if (ms < 1) {@@ -34,10 +37,11 @@ export function truncateStackTrace(stackTrace: string, maxLength = 70): string {return firstLine;}-export function formatRelativeTime(dateStr: string): string {- const date = new Date(dateStr);- const now = new Date();- const diffMs = now.getTime() - date.getTime();+export function formatRelativeTime(dateStr: string, timezone?: string): string {+ const tz = timezone ?? getTimezone();+ const dt = DateTime.fromISO(dateStr, { zone: 'utc' }).setZone(tz);+ const now = DateTime.now().setZone(tz);+ const diffMs = now.toMillis() - dt.toMillis();const diffMins = Math.floor(diffMs / 60000);const diffHours = Math.floor(diffMs / 3600000);const diffDays = Math.floor(diffMs / 86400000);@@ -47,3 +51,126 @@ export function formatRelativeTime(dateStr: string): string {if (diffHours < 24) return `${diffHours}h`;return `${diffDays}d`;}++export type DateTimeFormat = 'full' | 'short' | 'date' | 'time' | 'datetime' | 'iso';++export function formatDateTime(+ dateInput: string | Date | number,+ options: {+ timezone?: string;+ format?: DateTimeFormat;+ } = {}+): string {+ const tz = options.timezone ?? getTimezone();+ const isoStr =+ typeof dateInput === 'string'+ ? dateInput+ : dateInput instanceof Date+ ? dateInput.toISOString()+ : new Date(dateInput).toISOString();++ const dt = DateTime.fromISO(isoStr, { zone: 'utc' }).setZone(tz);++ if (!dt.isValid) {+ return 'Invalid date';+ }++ switch (options.format) {+ case 'full':+ return dt.toLocaleString(DateTime.DATETIME_FULL);+ case 'short':+ return dt.toLocaleString(DateTime.DATETIME_SHORT);+ case 'date':+ return dt.toLocaleString(DateTime.DATE_MED);+ case 'time':+ return dt.toLocaleString(DateTime.TIME_SIMPLE);+ case 'iso':+ return dt.toISO() ?? '';+ case 'datetime':+ default:+ return dt.toLocaleString(DateTime.DATETIME_MED);+ }+}++export function getNow(timezone?: string): DateTime {+ const tz = timezone ?? getTimezone();+ return DateTime.now().setZone(tz);+}++export function getTimeRangeFromPreset(+ preset: string,+ timezone?: string+): { from: DateTime; to: DateTime } {+ const tz = timezone ?? getTimezone();+ const now = DateTime.now().setZone(tz);++ const presetMinutes: Record<string, number> = {+ '30m': 30,+ '60m': 60,+ '3h': 180,+ '6h': 360,+ '12h': 720,+ '24h': 1440,+ '3d': 4320,+ '7d': 10080,+ '1M': 43200,+ '3M': 129600+ };++ const minutes = presetMinutes[preset] || 360;+ const from = now.minus({ minutes });++ return { from, to: now };+}++export function luxonToCalendarDateTime(dt: DateTime): {+ year: number;+ month: number;+ day: number;+ hour: number;+ minute: number;+ second: number;+} {+ return {+ year: dt.year,+ month: dt.month,+ day: dt.day,+ hour: dt.hour,+ minute: dt.minute,+ second: dt.second+ };+}++export function calendarDateTimeToLuxon(+ calDt: {+ year: number;+ month: number;+ day: number;+ hour?: number;+ minute?: number;+ second?: number;+ },+ timezone?: string+): DateTime {+ const tz = timezone ?? getTimezone();+ return DateTime.fromObject(+ {+ year: calDt.year,+ month: calDt.month,+ day: calDt.day,+ hour: calDt.hour ?? 0,+ minute: calDt.minute ?? 0,+ second: calDt.second ?? 0+ },+ { zone: tz }+ );+}++export function toUTCISO(dt: DateTime): string {+ return dt.toUTC().toISO() ?? '';+}++export function parseISO(dateStr: string, timezone?: string): DateTime {+ const tz = timezone ?? getTimezone();+ return DateTime.fromISO(dateStr, { zone: 'utc' }).setZone(tz);+}diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelteindex 0d6dca7f..64b0cfbf 100644--- a/frontend/src/routes/+layout.svelte+++ b/frontend/src/routes/+layout.svelte@@ -4,6 +4,7 @@import { authState } from '$lib/state/auth.svelte';import { projectsState } from '$lib/state/projects.svelte';import { themeState, initTheme, toggleTheme } from '$lib/state/theme.svelte';+ import { initTimezone } from '$lib/state/timezone.svelte';import AppSidebar from '$lib/components/app-sidebar.svelte';import AddProjectModal from '$lib/components/add-project-modal.svelte';import FrameworkIcon from '$lib/components/framework-icon.svelte';@@ -19,6 +20,7 @@onMount(() => {initTheme();+ initTimezone();// Load projects after auth checkif (authState.isAuthenticated) {diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelteindex 120fa0f4..8c2927e4 100644--- a/frontend/src/routes/+page.svelte+++ b/frontend/src/routes/+page.svelte@@ -2,6 +2,7 @@import { onMount } from 'svelte';import { createRowClickHandler } from '$lib/utils/navigation';import { formatDuration, formatRelativeTime, truncateStackTrace } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import { LoadingCircle } from '$lib/components/ui/loading-circle';import * as Table from '$lib/components/ui/table';import * as Tooltip from '$lib/components/ui/tooltip';@@ -14,6 +15,8 @@import { ErrorDisplay } from '$lib/components/ui/error-display';import { projectsState } from '$lib/state/projects.svelte';+ const timezone = $derived(getTimezone());+type ExceptionGroup = {exceptionHash: string;stackTrace: string;@@ -252,7 +255,7 @@{issue.count}</Table.Cell><Table.Cell class="py-3 text-right text-sm text-muted-foreground tabular-nums">- {formatRelativeTime(issue.lastSeen)}+ {formatRelativeTime(issue.lastSeen, timezone)}</Table.Cell></Table.Row>{/each}diff --git a/frontend/src/routes/issues/+page.svelte b/frontend/src/routes/issues/+page.svelteindex d6644cab..fe0b4d2f 100644--- a/frontend/src/routes/issues/+page.svelte+++ b/frontend/src/routes/issues/+page.svelte@@ -9,11 +9,15 @@import { LoadingCircle } from '$lib/components/ui/loading-circle';import { Checkbox } from '$lib/components/ui/checkbox';import { projectsState } from '$lib/state/projects.svelte';+ import { getTimezone } from '$lib/state/timezone.svelte';import IssueTrendChart from '$lib/components/issue-trend-chart.svelte';import Archive from '@lucide/svelte/icons/archive';import { TracewayTableHeader } from '$lib/components/ui/traceway-table-header';import { TableEmptyState } from '$lib/components/ui/table-empty-state';import { PaginationFooter } from '$lib/components/ui/pagination-footer';+ import { formatDateTime, getNow, toUTCISO } from '$lib/utils/formatters';++ const timezone = $derived(getTimezone());type ExceptionTrendPoint = {timestamp: string;@@ -79,13 +83,12 @@error = '';try {- const now = new Date();- const fromDate = new Date();- fromDate.setDate(now.getDate() - parseInt(daysBack));+ const now = getNow(timezone);+ const fromDate = now.minus({ days: parseInt(daysBack) });const requestBody = {- fromDate: fromDate.toISOString(),- toDate: now.toISOString(),+ fromDate: toUTCISO(fromDate),+ toDate: toUTCISO(now),orderBy: 'last_seen',pagination: {page: page,@@ -335,7 +338,7 @@class="text-muted-foreground"onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}>- {new Date(exception.lastSeen).toLocaleString()}+ {formatDateTime(exception.lastSeen, { timezone })}</Table.Cell></Table.Row>{/each}diff --git a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelteindex 26406485..439e1306 100644--- a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelte@@ -4,11 +4,15 @@import { LoadingCircle } from "$lib/components/ui/loading-circle";import { ErrorDisplay } from "$lib/components/ui/error-display";import { projectsState } from '$lib/state/projects.svelte';+ import { getTimezone } from '$lib/state/timezone.svelte';+ import { formatDateTime } from '$lib/utils/formatters';import { StackTraceCard, EventCard, EventsTable, PageHeader } from '$lib/components/issues';import type { ExceptionGroup, ExceptionOccurrence, LinkedTransaction } from '$lib/types/exceptions';let { data } = $props();+ const timezone = $derived(getTimezone());+let group = $state<ExceptionGroup | null>(null);let occurrence = $state<ExceptionOccurrence | null>(null);let allOccurrences = $state<ExceptionOccurrence[]>([]);@@ -90,7 +94,7 @@<div class="space-y-6"><PageHeadertitle={firstLineOfStackTrace}- subtitle="Event from {new Date(data.recordedAt).toLocaleString()}"+ subtitle="Event from {formatDateTime(data.recordedAt, { timezone })}"backHref="/issues/{data.exceptionHash}"/>diff --git a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelteindex 8088f1eb..8a9cab23 100644--- a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte@@ -3,7 +3,8 @@import { page } from '$app/state';import { goto } from '$app/navigation';import { createRowClickHandler } from '$lib/utils/navigation';- import { truncateStackTrace } from '$lib/utils/formatters';+ import { truncateStackTrace, formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import { api } from '$lib/api';import { Button } from "$lib/components/ui/button";import * as Card from "$lib/components/ui/card";@@ -16,6 +17,8 @@import { TableEmptyState } from "$lib/components/ui/table-empty-state";import { PaginationFooter } from "$lib/components/ui/pagination-footer";+ const timezone = $derived(getTimezone());+type ExceptionGroup = {exceptionHash: string;stackTrace: string;@@ -187,7 +190,7 @@class="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(`/issues/${page.params.exceptionHash}/${encodeURIComponent(occurrence.recordedAt)}`)}>- <Table.Cell>{new Date(occurrence.recordedAt).toLocaleString()}</Table.Cell>+ <Table.Cell>{formatDateTime(occurrence.recordedAt, { timezone })}</Table.Cell><Table.Cell class="font-mono text-sm text-muted-foreground">{occurrence.serverName || '-'}</Table.Cell>diff --git a/frontend/src/routes/metrics/+page.svelte b/frontend/src/routes/metrics/+page.svelteindex b4ee84cd..5a4759cf 100644--- a/frontend/src/routes/metrics/+page.svelte+++ b/frontend/src/routes/metrics/+page.svelte@@ -16,10 +16,14 @@import { api } from '$lib/api';import { ErrorDisplay } from '$lib/components/ui/error-display';import { projectsState } from '$lib/state/projects.svelte';+ import { getTimezone } from '$lib/state/timezone.svelte';+ import { getNow, parseISO, toUTCISO, calendarDateTimeToLuxon, formatDateTime } from '$lib/utils/formatters';import { TimeRangePicker } from '$lib/components/ui/time-range-picker';import { CalendarDate } from '@internationalized/date';import { getServerColorMap } from '$lib/utils/server-colors';+ const timezone = $derived(getTimezone());+let dashboardData = $state<DashboardData | null>(null);let loading = $state(true);let error = $state('');@@ -47,11 +51,11 @@};// Calculate time range from preset- function getTimeRangeFromPreset(presetValue: string): { from: Date; to: Date } {+ function getTimeRangeFromPresetLocal(presetValue: string): { from: Date; to: Date } {const minutes = presetMinutes[presetValue] || 360; // Default to 6h- const now = new Date();- const from = new Date(now.getTime() - minutes * 60 * 1000);- return { from, to: now };+ const now = getNow(timezone);+ const from = now.minus({ minutes });+ return { from: from.toJSDate(), to: now.toJSDate() };}// Parse URL params@@ -78,10 +82,10 @@// If custom from/to specifiedif (fromParam && toParam) {- const from = new Date(fromParam);- const to = new Date(toParam);- if (!isNaN(from.getTime()) && !isNaN(to.getTime())) {- return { preset: null, from, to, servers };+ const fromDt = parseISO(fromParam, timezone);+ const toDt = parseISO(toParam, timezone);+ if (fromDt.isValid && toDt.isValid) {+ return { preset: null, from: fromDt.toJSDate(), to: toDt.toJSDate(), servers };}}@@ -100,7 +104,7 @@// Initialize from URL or defaultsconst initialUrlParams = parseUrlParams();const initialRange = initialUrlParams.preset- ? getTimeRangeFromPreset(initialUrlParams.preset)+ ? getTimeRangeFromPresetLocal(initialUrlParams.preset): { from: initialUrlParams.from!, to: initialUrlParams.to! };let selectedPreset = $state<string | null>(initialUrlParams.preset);@@ -121,10 +125,8 @@params.set('preset', selectedPreset);} else {// Store custom from/to in URL- const fromDateTime = new Date(getFromDateTime());- const toDateTime = new Date(getToDateTime());- params.set('from', fromDateTime.toISOString());- params.set('to', toDateTime.toISOString());+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());}// Store server selection in URL (only if not all servers selected)@@ -147,7 +149,7 @@if (urlParams.preset) {selectedPreset = urlParams.preset;- const range = getTimeRangeFromPreset(urlParams.preset);+ const range = getTimeRangeFromPresetLocal(urlParams.preset);fromDate = dateToCalendarDate(range.from);fromTime = dateToTimeString(range.from);toDate = dateToCalendarDate(range.to);@@ -166,15 +168,17 @@loadDashboard(false); // Don't push to history on popstate}- // Combine date and time into ISO datetime string- function getFromDateTime(): string {- const dateStr = `${fromDate.year}-${String(fromDate.month).padStart(2, '0')}-${String(fromDate.day).padStart(2, '0')}`;- return `${dateStr}T${fromTime || '00:00'}`;+ // Combine date and time into UTC ISO datetime string+ function getFromDateTimeUTC(): string {+ const [hour, minute] = (fromTime || '00:00').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: fromDate.year, month: fromDate.month, day: fromDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}- function getToDateTime(): string {- const dateStr = `${toDate.year}-${String(toDate.month).padStart(2, '0')}-${String(toDate.day).padStart(2, '0')}`;- return `${dateStr}T${toTime || '23:59'}`;+ function getToDateTimeUTC(): string {+ const [hour, minute] = (toTime || '23:59').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: toDate.year, month: toDate.month, day: toDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}function handleTimeRangeChange(@@ -214,14 +218,14 @@updateUrl(pushToHistory);try {- const fromDateTime = new Date(getFromDateTime());- const toDateTime = new Date(getToDateTime());+ const fromDateTimeUTC = getFromDateTimeUTC();+ const toDateTimeUTC = getToDateTimeUTC();// Store shared time domain for charts- sharedTimeDomain = [fromDateTime, toDateTime];+ sharedTimeDomain = [new Date(fromDateTimeUTC), new Date(toDateTimeUTC)];// Build query params for date range and server selection- let queryParams = `fromDate=${fromDateTime.toISOString()}&toDate=${toDateTime.toISOString()}`;+ let queryParams = `fromDate=${fromDateTimeUTC}&toDate=${toDateTimeUTC}`;if (selectedServers.length > 0 && selectedServers.length < availableServers.length) {queryParams += `&servers=${selectedServers.join(',')}`;}@@ -295,12 +299,7 @@const lastUpdatedFormatted = $derived(dashboardData?.lastUpdated- ? dashboardData.lastUpdated.toLocaleString('en-US', {- hour: '2-digit',- minute: '2-digit',- second: '2-digit',- hour12: false- })+ ? formatDateTime(dashboardData.lastUpdated, { timezone, format: 'time' }): '');</script>diff --git a/frontend/src/routes/transactions/+page.svelte b/frontend/src/routes/transactions/+page.svelteindex 0ebf99e8..12339bd6 100644--- a/frontend/src/routes/transactions/+page.svelte+++ b/frontend/src/routes/transactions/+page.svelte@@ -2,7 +2,8 @@import { onMount, onDestroy } from 'svelte';import { browser } from '$app/environment';import { api } from '$lib/api';- import { formatDuration } from '$lib/utils/formatters';+ import { formatDuration, getNow, luxonToCalendarDateTime, parseISO, toUTCISO, calendarDateTimeToLuxon } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import * as Table from "$lib/components/ui/table";import { Button } from "$lib/components/ui/button";import { LoadingCircle } from "$lib/components/ui/loading-circle";@@ -15,6 +16,8 @@import { CalendarDate, getLocalTimeZone, today } from "@internationalized/date";import { projectsState } from '$lib/state/projects.svelte';+ const timezone = $derived(getTimezone());+type EndpointStats = {endpoint: string;count: number;@@ -52,11 +55,11 @@};// Helper functions- function getTimeRangeFromPreset(presetValue: string): { from: Date; to: Date } {+ function getTimeRangeFromPresetLocal(presetValue: string): { from: Date; to: Date } {const minutes = presetMinutes[presetValue] || 360;- const now = new Date();- const from = new Date(now.getTime() - minutes * 60 * 1000);- return { from, to: now };+ const now = getNow(timezone);+ const from = now.minus({ minutes });+ return { from: from.toJSDate(), to: now.toJSDate() };}function dateToCalendarDate(date: Date): CalendarDate {@@ -82,10 +85,10 @@// If custom from/to specifiedif (fromParam && toParam) {- const from = new Date(fromParam);- const to = new Date(toParam);- if (!isNaN(from.getTime()) && !isNaN(to.getTime())) {- return { preset: null, from, to };+ const fromDt = parseISO(fromParam, timezone);+ const toDt = parseISO(toParam, timezone);+ if (fromDt.isValid && toDt.isValid) {+ return { preset: null, from: fromDt.toJSDate(), to: toDt.toJSDate() };}}@@ -96,7 +99,7 @@// Initialize from URLconst initialUrlParams = parseUrlParams();const initialRange = initialUrlParams.preset- ? getTimeRangeFromPreset(initialUrlParams.preset)+ ? getTimeRangeFromPresetLocal(initialUrlParams.preset): { from: initialUrlParams.from!, to: initialUrlParams.to! };// Date Range State@@ -115,10 +118,8 @@if (selectedPreset) {params.set('preset', selectedPreset);} else {- const fromDateTime = new Date(getFromDateTime());- const toDateTime = new Date(getToDateTime());- params.set('from', fromDateTime.toISOString());- params.set('to', toDateTime.toISOString());+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());}const newUrl = `${window.location.pathname}?${params.toString()}`;@@ -136,7 +137,7 @@if (urlParams.preset) {selectedPreset = urlParams.preset;- const range = getTimeRangeFromPreset(urlParams.preset);+ const range = getTimeRangeFromPresetLocal(urlParams.preset);fromDate = dateToCalendarDate(range.from);fromTime = dateToTimeString(range.from);toDate = dateToCalendarDate(range.to);@@ -167,15 +168,17 @@const pageSizeLabel = $derived(pageSizeOptions.find(o => o.value === pageSize.toString())?.label ?? pageSize.toString());- // Combine date and time into ISO datetime string- function getFromDateTime(): string {- const dateStr = `${fromDate.year}-${String(fromDate.month).padStart(2, '0')}-${String(fromDate.day).padStart(2, '0')}`;- return `${dateStr}T${fromTime || '00:00'}`;+ // Combine date and time into UTC ISO datetime string+ function getFromDateTimeUTC(): string {+ const [hour, minute] = (fromTime || '00:00').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: fromDate.year, month: fromDate.month, day: fromDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}- function getToDateTime(): string {- const dateStr = `${toDate.year}-${String(toDate.month).padStart(2, '0')}-${String(toDate.day).padStart(2, '0')}`;- return `${dateStr}T${toTime || '23:59'}`;+ function getToDateTimeUTC(): string {+ const [hour, minute] = (toTime || '23:59').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: toDate.year, month: toDate.month, day: toDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}function handleTimeRangeChange(from: { date: CalendarDate; time: string }, to: { date: CalendarDate; time: string }, preset: string | null) {@@ -218,8 +221,8 @@try {const requestBody = {- fromDate: new Date(getFromDateTime()).toISOString(),- toDate: new Date(getToDateTime()).toISOString(),+ fromDate: getFromDateTimeUTC(),+ toDate: getToDateTimeUTC(),orderBy: orderBy,sortDirection: sortDirection,pagination: {@@ -272,8 +275,8 @@if (selectedPreset) {params.set('preset', selectedPreset);} else {- params.set('from', new Date(getFromDateTime()).toISOString());- params.set('to', new Date(getToDateTime()).toISOString());+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());}return `/transactions/${encodeURIComponent(endpoint)}?${params.toString()}`;}diff --git a/frontend/src/routes/transactions/[endpoint]/+page.svelte b/frontend/src/routes/transactions/[endpoint]/+page.svelteindex f4bb8f93..42bf48a2 100644--- a/frontend/src/routes/transactions/[endpoint]/+page.svelte+++ b/frontend/src/routes/transactions/[endpoint]/+page.svelte@@ -2,7 +2,8 @@import { onMount } from 'svelte';import { goto } from '$app/navigation';import { api } from '$lib/api';- import { formatDuration, formatDurationMs, getStatusColor } from '$lib/utils/formatters';+ import { formatDuration, formatDurationMs, getStatusColor, formatDateTime, getNow, parseISO, toUTCISO, calendarDateTimeToLuxon } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import * as Table from "$lib/components/ui/table";import { Button } from "$lib/components/ui/button";import { LoadingCircle } from "$lib/components/ui/loading-circle";@@ -16,6 +17,8 @@import ScopeDisplay from '$lib/components/scope-display.svelte';import { createRowClickHandler } from '$lib/utils/navigation';+ const timezone = $derived(getTimezone());+type Transaction = {id: string;endpoint: string;@@ -73,11 +76,11 @@};// Helper functions- function getTimeRangeFromPreset(presetValue: string): { from: Date; to: Date } {+ function getTimeRangeFromPresetLocal(presetValue: string): { from: Date; to: Date } {const minutes = presetMinutes[presetValue] || 360;- const now = new Date();- const from = new Date(now.getTime() - minutes * 60 * 1000);- return { from, to: now };+ const now = getNow(timezone);+ const from = now.minus({ minutes });+ return { from: from.toJSDate(), to: now.toJSDate() };}function dateToCalendarDate(date: Date): CalendarDate {@@ -92,21 +95,21 @@function getInitialRange(): { preset: string | null; from: Date; to: Date } {// If preset is provided, use itif (data.preset && presetMinutes[data.preset]) {- const range = getTimeRangeFromPreset(data.preset);+ const range = getTimeRangeFromPresetLocal(data.preset);return { preset: data.preset, from: range.from, to: range.to };}// If custom from/to providedif (data.from && data.to) {- const from = new Date(data.from);- const to = new Date(data.to);- if (!isNaN(from.getTime()) && !isNaN(to.getTime())) {- return { preset: null, from, to };+ const fromDt = parseISO(data.from, timezone);+ const toDt = parseISO(data.to, timezone);+ if (fromDt.isValid && toDt.isValid) {+ return { preset: null, from: fromDt.toJSDate(), to: toDt.toJSDate() };}}// Default to 6h preset- const range = getTimeRangeFromPreset('6h');+ const range = getTimeRangeFromPresetLocal('6h');return { preset: '6h', from: range.from, to: range.to };}@@ -123,15 +126,17 @@let orderBy = $state<SortField>('recorded_at');let sortDirection = $state<SortDirection>('desc');- // Combine date and time into ISO datetime string- function getFromDateTime(): string {- const dateStr = `${fromDate.year}-${String(fromDate.month).padStart(2, '0')}-${String(fromDate.day).padStart(2, '0')}`;- return `${dateStr}T${fromTime || '00:00'}`;+ // Combine date and time into UTC ISO datetime string+ function getFromDateTimeUTC(): string {+ const [hour, minute] = (fromTime || '00:00').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: fromDate.year, month: fromDate.month, day: fromDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}- function getToDateTime(): string {- const dateStr = `${toDate.year}-${String(toDate.month).padStart(2, '0')}-${String(toDate.day).padStart(2, '0')}`;- return `${dateStr}T${toTime || '23:59'}`;+ function getToDateTimeUTC(): string {+ const [hour, minute] = (toTime || '23:59').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: toDate.year, month: toDate.month, day: toDate.day, hour, minute }, timezone);+ return toUTCISO(dt);}function handleTimeRangeChange(from: { date: CalendarDate; time: string }, to: { date: CalendarDate; time: string }, preset: string | null) {@@ -162,8 +167,8 @@try {const requestBody = {- fromDate: new Date(getFromDateTime()).toISOString(),- toDate: new Date(getToDateTime()).toISOString(),+ fromDate: getFromDateTimeUTC(),+ toDate: getToDateTimeUTC(),orderBy: orderBy,sortDirection: sortDirection,pagination: {@@ -216,8 +221,8 @@if (selectedPreset) {params.set('preset', selectedPreset);} else {- params.set('from', new Date(getFromDateTime()).toISOString());- params.set('to', new Date(getToDateTime()).toISOString());+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());}goto(`/transactions?${params.toString()}`);}@@ -228,8 +233,8 @@if (selectedPreset) {params.set('preset', selectedPreset);} else {- params.set('from', new Date(getFromDateTime()).toISOString());- params.set('to', new Date(getToDateTime()).toISOString());+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());}return `/transactions/${encodeURIComponent(data.endpoint)}/${transactionId}?${params.toString()}`;}@@ -382,7 +387,7 @@onclick={createRowClickHandler(getTransactionDetailUrl(transaction.id))}><Table.Cell class="text-muted-foreground">- {new Date(transaction.recordedAt).toLocaleString()}+ {formatDateTime(transaction.recordedAt, { timezone })}</Table.Cell><Table.Cell class="font-mono text-sm">{formatDuration(transaction.duration)}diff --git a/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte b/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelteindex 5768f210..916d2489 100644--- a/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte+++ b/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte@@ -2,7 +2,8 @@import { onMount } from 'svelte';import { goto } from '$app/navigation';import { api } from '$lib/api';- import { formatDuration, getStatusColor } from '$lib/utils/formatters';+ import { formatDuration, getStatusColor, formatDateTime } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';import { Button } from '$lib/components/ui/button';import * as Card from '$lib/components/ui/card';import { LoadingCircle } from '$lib/components/ui/loading-circle';@@ -17,6 +18,8 @@let { data } = $props();+ const timezone = $derived(getTimezone());+let response = $state<TransactionDetailResponse | null>(null);let loading = $state(true);let error = $state('');@@ -147,7 +150,7 @@/><LabelValuelabel="Recorded At"- value={new Date(response.transaction.recordedAt).toLocaleString()}+ value={formatDateTime(response.transaction.recordedAt, { timezone })}mono/><LabelValue