: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(workflows): hide repeat toggle and always show timezone for recurring broadcasts (#109309)
Daniel Marchuka81fc2e2992d
diff --git a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.tsindex ee99d109b086..cd9d8888b995 100644--- a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts+++ b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts@@ -949,7 +949,7 @@ export const broadcastWizardLogic = kea<broadcastWizardLogicType>([if (!recurringRepeating) {return `Sends once on ${dayjs(recurringStartsAt).tz(effectiveTimezone).format('MMMM D, YYYY h:mm A')} (${effectiveTimezone})`}- return buildSummary(scheduleState, recurringStartsAt)+ return buildSummary(scheduleState, recurringStartsAt, effectiveTimezone)},],rateLimitedSendDuration: [diff --git a/products/workflows/frontend/Broadcasts/steps/BroadcastScheduleStep.tsx b/products/workflows/frontend/Broadcasts/steps/BroadcastScheduleStep.tsxindex c4d8bee1cf15..dc9b2e70d83f 100644--- a/products/workflows/frontend/Broadcasts/steps/BroadcastScheduleStep.tsx+++ b/products/workflows/frontend/Broadcasts/steps/BroadcastScheduleStep.tsx@@ -117,6 +117,8 @@ export function BroadcastScheduleStep(): JSX.Element {onStartsAtChange={setRecurringStartsAtFromPicker}onTimezoneChange={setScheduleTimezone}onRepeatingChange={setRecurringRepeating}+ showRepeatToggle={false}+ alwaysShowTimezone/></div>)}diff --git a/products/workflows/frontend/Workflows/WorkflowBatchInvocations.tsx b/products/workflows/frontend/Workflows/WorkflowBatchInvocations.tsxindex 521311b0a38c..fece25783f08 100644--- a/products/workflows/frontend/Workflows/WorkflowBatchInvocations.tsx+++ b/products/workflows/frontend/Workflows/WorkflowBatchInvocations.tsx@@ -161,7 +161,9 @@ function UpcomingOccurrences(): JSX.Element | null {return computePreviewOccurrences(scheduleState, currentSchedule.starts_at, currentSchedule.timezone)}, [scheduleState, currentSchedule])- const summary = scheduleState ? buildSummary(scheduleState, currentSchedule?.starts_at ?? null) : null+ const summary = scheduleState+ ? buildSummary(scheduleState, currentSchedule?.starts_at ?? null, currentSchedule?.timezone)+ : nullconst timezone = currentSchedule?.timezoneconst hasFutureOccurrences = occurrences.some((d) => fakeUtcToReal(d, timezone).isAfter(dayjs()))diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/RecurringSchedulePicker.tsx b/products/workflows/frontend/Workflows/hogflows/steps/components/RecurringSchedulePicker.tsxindex 97c9e1ed4e6d..2dc0fa7a6b37 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/RecurringSchedulePicker.tsx+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/RecurringSchedulePicker.tsx@@ -329,6 +329,10 @@ export interface RecurringSchedulePickerProps {onStartsAtChange: (pickerDate: string | null) => voidonTimezoneChange: (timezone: string, previousTimezone: string) => voidonRepeatingChange: (repeating: boolean) => void+ /** Off where the caller already means repeating, such as a broadcast's Recurring option. */+ showRepeatToggle?: boolean+ /** Shows the timezone before a start date is picked. */+ alwaysShowTimezone?: boolean}export function RecurringSchedulePicker({@@ -340,6 +344,8 @@ export function RecurringSchedulePicker({onStartsAtChange: setScheduleStartsAtFromPicker,onTimezoneChange: setScheduleTimezone,onRepeatingChange: setScheduleRepeating,+ showRepeatToggle = true,+ alwaysShowTimezone = false,}: RecurringSchedulePickerProps): JSX.Element {const previewOccurrences = useMemo(() => {if (!isScheduleRepeating || !scheduleStartsAt) {@@ -360,7 +366,7 @@ export function RecurringSchedulePicker({scheduleState.endCount,])- const summary = isScheduleRepeating ? buildSummary(scheduleState, scheduleStartsAt) : null+ const summary = isScheduleRepeating ? buildSummary(scheduleState, scheduleStartsAt, scheduleTimezone) : nullconst monthlyDayLabel = scheduleStartsAt ? `Day ${dayjs(scheduleStartsAt).date()}` : 'Day N'const monthlyNthLabel = scheduleStartsAt@@ -393,7 +399,7 @@ export function RecurringSchedulePicker({showTimeToggle={false}/></div>- {scheduleStartsAt && (+ {scheduleStartsAt && showRepeatToggle && (<div className="w-22 shrink-0"><LemonSwitchlabel="Repeat"@@ -403,7 +409,7 @@ export function RecurringSchedulePicker({</div>)}</div>- {scheduleStartsAt && (+ {(scheduleStartsAt || alwaysShowTimezone) && (<div className="flex flex-col gap-1 -mt-1"><div className="flex items-center gap-2"><div className="flex-1 min-w-0">@@ -414,9 +420,9 @@ export function RecurringSchedulePicker({}}/></div>- <div className="w-22 shrink-0" />+ {showRepeatToggle && <div className="w-22 shrink-0" />}</div>- {scheduleTimezone !== dayjs.tz.guess() && (+ {scheduleStartsAt && scheduleTimezone !== dayjs.tz.guess() && (<span className="text-xs text-muted">Schedule: {dayjs(scheduleStartsAt).tz(scheduleTimezone).format('h:mm A')} {scheduleTimezone}{' '}· Your time: {dayjs(scheduleStartsAt).format('h:mm A')} {dayjs.tz.guess()}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.test.ts b/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.test.tsindex b8801e8b482e..032c7c15b064 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.test.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.test.ts@@ -365,10 +365,13 @@ describe('rrule-helpers', () => {expect(result).toContain('until December 25, 2024')})- it('includes starting date when startsAt is provided', () => {+ it.each([+ ['2024-06-01', undefined, 'starting June 1'],+ ['2026-10-01T00:18:00Z', 'US/Pacific', 'starting September 30'],+ ['2026-09-30T22:18:00Z', 'Europe/Prague', 'starting October 1'],+ ])('names the starting date of %s in the schedule timezone %s', (startsAt, timezone, expected) => {const state: ScheduleState = { ...DEFAULT_STATE, frequency: 'daily' }- const result = buildSummary(state, '2024-06-01')- expect(result).toContain('starting June 1')+ expect(buildSummary(state, startsAt, timezone)).toContain(expected)})it('ends with a period', () => {diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.ts b/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.tsindex 730a4e7578f4..709b2aa6e937 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/rrule-helpers.ts@@ -241,7 +241,8 @@ export function fakeUtcToReal(date: Date, timezone?: string): dayjs.Dayjs {return timezone ? dayjs.tz(utcStr, timezone) : dayjs.utc(utcStr)}-export function buildSummary(state: ScheduleState, startsAt: string | null): string {+export function buildSummary(state: ScheduleState, startsAt: string | null, timezone?: string): string {+ const start = startsAt ? (timezone ? dayjs(startsAt).tz(timezone) : dayjs(startsAt)) : nullconst freqLabel = state.frequency === 'daily' ? 'day' : state.frequency.replace('ly', '')const intervalStr = state.interval > 1 ? `${state.interval} ${freqLabel}s` : freqLabel@@ -255,16 +256,16 @@ export function buildSummary(state: ScheduleState, startsAt: string | null): strif (state.frequency === 'monthly') {if (state.monthlyMode === 'last_day') {summary += ` on the last day`- } else if (state.monthlyMode === 'day_of_month' && startsAt) {- summary += ` on the ${dayjs(startsAt).format('Do')}`- } else if (state.monthlyMode === 'nth_weekday' && startsAt) {- const { n, weekday } = getNthWeekdayOfMonth(dayjs(startsAt))+ } else if (state.monthlyMode === 'day_of_month' && start) {+ summary += ` on the ${start.format('Do')}`+ } else if (state.monthlyMode === 'nth_weekday' && start) {+ const { n, weekday } = getNthWeekdayOfMonth(start)summary += ` on the ${NTH_LABELS[n - 1]} ${WEEKDAY_FULL_LABELS[weekday]}`}}- if (startsAt) {- summary += `, starting ${dayjs(startsAt).format('MMMM D')}`+ if (start) {+ summary += `, starting ${start.format('MMMM D')}`}if (state.endType === 'after_count') {