Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay-vision): show schedule timezone and align run times (#73250)

Arno Hillen80c066c130a2
diff --git a/products/replay_vision/frontend/replay_scanners/VisionActionScene.tsx b/products/replay_vision/frontend/replay_scanners/VisionActionScene.tsx
index 694babb0828d..40bacde9afff 100644
--- a/products/replay_vision/frontend/replay_scanners/VisionActionScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/VisionActionScene.tsx
@@ -58,7 +58,9 @@ function ActionOverview({
? 'Checked every few minutes; each alert covers the new matches since the last check'
: 'Checked about every hour; notifies when the threshold starts being crossed'
: scheduleLabel
- ? `Runs ${scheduleLabel.toLowerCase()}`
+ ? // Lowercase only the leading "Daily"/"Weekly" so it reads as a sentence;
+ // keep weekday names and the timezone acronym (e.g. PDT) in their own case.
+ `Runs ${scheduleLabel.charAt(0).toLowerCase()}${scheduleLabel.slice(1)}`
: undefined
}
resourceType={{ type: 'replay_vision' }}
@@ -110,7 +112,7 @@ function ActionOverview({
function VisionActionDetail(): JSX.Element {
const { action, actionLoading } = useValues(visionActionRunsLogic)
const rrule = action?.trigger_config?.rrule
- const schedule = rrule ? humanizeCadence(parseRruleToCadence(rrule)) : null
+ const schedule = rrule ? humanizeCadence(parseRruleToCadence(rrule), action?.trigger_config?.timezone) : null
return (
<SceneContent>
diff --git a/products/replay_vision/frontend/replay_scanners/cadence.test.ts b/products/replay_vision/frontend/replay_scanners/cadence.test.ts
index 9a5631b9733d..1c4787966c30 100644
--- a/products/replay_vision/frontend/replay_scanners/cadence.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/cadence.test.ts
@@ -59,4 +59,16 @@ describe('cadence', () => {
expect(humanizeCadence({ weekdays: [0, 2], hour: 14, minute: 0 })).toBe('Weekly on Mon, Wed at 14:00')
expect(humanizeCadence({ weekdays: [], hour: 8, minute: 0 })).toBe('Pick at least one day')
})
+
+ it('labels the time with the schedule timezone so it is not read as the viewer local time', () => {
+ // UTC keeps this deterministic. A named zone's abbreviation flips with DST.
+ expect(humanizeCadence({ weekdays: [0, 1, 2, 3, 4, 5, 6], hour: 8, minute: 0 }, 'UTC')).toBe(
+ 'Daily at 08:00 UTC'
+ )
+ expect(humanizeCadence({ weekdays: [0, 2], hour: 14, minute: 0 }, 'UTC')).toBe(
+ 'Weekly on Mon, Wed at 14:00 UTC'
+ )
+ // Timezone is optional; without it the label stays as before.
+ expect(humanizeCadence({ weekdays: [0, 1, 2, 3, 4, 5, 6], hour: 8, minute: 0 })).toBe('Daily at 08:00')
+ })
})
diff --git a/products/replay_vision/frontend/replay_scanners/cadence.ts b/products/replay_vision/frontend/replay_scanners/cadence.ts
index 80fa8854924d..1f49c7b9ed69 100644
--- a/products/replay_vision/frontend/replay_scanners/cadence.ts
+++ b/products/replay_vision/frontend/replay_scanners/cadence.ts
@@ -15,6 +15,8 @@
// live in the rrule itself via BYHOUR/BYMINUTE (dateutil honors those over the dtstart
// time component).
+import { shortTimeZone } from 'lib/utils/timezones'
+
export interface CadenceState {
/** Days of week the action runs on. 0=Mon … 6=Sun. Must contain at least one; all seven = daily. */
weekdays: number[]
@@ -95,11 +97,16 @@ export function parseRruleToCadence(rrule: string | undefined | null): CadenceSt
return { weekdays: weekdays.length > 0 ? weekdays : [...ALL_WEEKDAYS], hour, minute }
}
-export function humanizeCadence(state: CadenceState): string {
- const time = `${pad2(state.hour)}:${pad2(state.minute)}`
+// The run time of day is a wall-clock time in `timezone` (defaults to the team's tz on the
+// backend), not the viewer's. Without the zone, "08:00" reads as ambiguous against the
+// next-run stat, which a TZLabel renders in the viewer's own timezone. Pass the action's
+// timezone so the label states which zone it means.
+export function humanizeCadence(state: CadenceState, timezone?: string | null): string {
if (state.weekdays.length === 0) {
return 'Pick at least one day'
}
+ const tz = timezone ? shortTimeZone(timezone) : null
+ const time = `${pad2(state.hour)}:${pad2(state.minute)}${tz ? ` ${tz}` : ''}`
if (state.weekdays.length === 7) {
return `Daily at ${time}`
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/VisionActionRuns.tsx b/products/replay_vision/frontend/replay_scanners/components/VisionActionRuns.tsx
index ab23871c80d9..c5c24c932c47 100644
--- a/products/replay_vision/frontend/replay_scanners/components/VisionActionRuns.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/VisionActionRuns.tsx
@@ -41,6 +41,9 @@ function RunStats(): JSX.Element {
const isAlert = action?.mode === VisionActionModeEnumApi.Alert
// every_match rides each scanner sweep; on_breach thresholds are re-checked hourly.
const everyMatch = action?.alert_config?.frequency === 'every_match'
+ // Show run times in the schedule's own timezone so "Next run" lines up with the "Runs daily
+ // at HH:MM" label. The TZLabel popover still converts to the viewer's device tz and UTC.
+ const scheduleTimezone = action?.trigger_config?.timezone
return (
<div className="flex flex-wrap sm:flex-nowrap items-stretch border rounded bg-surface-primary">
<StatCell
@@ -52,7 +55,12 @@ function RunStats(): JSX.Element {
title={isAlert ? 'Last checked' : 'Last run'}
value={
action?.last_run_at ? (
- <TZLabel time={action.last_run_at} formatDate="MMM D, YYYY" formatTime="HH:mm" />
+ <TZLabel
+ time={action.last_run_at}
+ displayTimezone={scheduleTimezone}
+ formatDate="MMM D, YYYY"
+ formatTime="HH:mm"
+ />
) : (
'Never'
)
@@ -71,7 +79,12 @@ function RunStats(): JSX.Element {
// showing it would overstate the gap between checks. on_breach follows the cursor.
'Within minutes'
) : action?.next_run_at ? (
- <TZLabel time={action.next_run_at} formatDate="MMM D, YYYY" formatTime="HH:mm" />
+ <TZLabel
+ time={action.next_run_at}
+ displayTimezone={scheduleTimezone}
+ formatDate="MMM D, YYYY"
+ formatTime="HH:mm"
+ />
) : (
'—'
)
@@ -100,8 +113,9 @@ function EmptyRuns(): JSX.Element {
}
export function VisionActionRuns(): JSX.Element {
- const { runs, runsLoading } = useValues(visionActionRunsLogic)
+ const { action, runs, runsLoading } = useValues(visionActionRunsLogic)
const { actionId } = useValues(visionActionSceneLogic)
+ const scheduleTimezone = action?.trigger_config?.timezone
const columns: LemonTableColumns<VisionActionRunListApi> = [
{
@@ -109,7 +123,12 @@ export function VisionActionRuns(): JSX.Element {
key: 'when',
render: (_, run) => (
<Link className="font-semibold" to={urls.replayVisionActionRun(actionId, run.id)}>
- <TZLabel time={run.scheduled_at ?? run.created_at} formatDate="MMM D, YYYY" formatTime="HH:mm" />
+ <TZLabel
+ time={run.scheduled_at ?? run.created_at}
+ displayTimezone={scheduleTimezone}
+ formatDate="MMM D, YYYY"
+ formatTime="HH:mm"
+ />
</Link>
),
},
diff --git a/products/replay_vision/frontend/replay_scanners/components/VisionActionsTab.tsx b/products/replay_vision/frontend/replay_scanners/components/VisionActionsTab.tsx
index 4d3776afa6f0..e41d9def293e 100644
--- a/products/replay_vision/frontend/replay_scanners/components/VisionActionsTab.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/VisionActionsTab.tsx
@@ -42,7 +42,7 @@ function humanizeSchedule(action: VisionActionApi): string {
if (freq !== 'DAILY' && freq !== 'WEEKLY') {
return rrule
}
- return humanizeCadence(parseRruleToCadence(rrule))
+ return humanizeCadence(parseRruleToCadence(rrule), action.trigger_config?.timezone)
}
// Every write control on this tab needs replay_scanner editor access; all but delete also need