: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
import { useValues } from 'kea'
import { TZLabel } from 'lib/components/TZLabel'
import { Label } from 'lib/ui/Label/Label'
import { experimentLogic } from 'scenes/experiments/experimentLogic'
import { LegacyExperimentDate } from './LegacyExperimentDate'
export function LegacyExperimentDates(): JSX.Element | null {
const { experiment } = useValues(experimentLogic)
const { created_at, start_date, end_date } = experiment
// If the experiment has no start date and no creation date, don't show anything
if (!start_date && !created_at) {
return null
}
// If the experiment has no start date but has a creation date, show the creation date.
// This also narrows the type of created_at to be non-null
if (!start_date && created_at) {
return (
<div className="flex flex-col" data-attr="experiment-creation-date">
<Label intent="menu">Creation date</Label>
<TZLabel time={created_at} />
</div>
)
}
// If the experiment has a start date, show the start date and end date
return (
<>
<LegacyExperimentDate label="Start Date" date={start_date} data-attr="experiment-start-date" />
<LegacyExperimentDate label="End Date" date={end_date} data-attr="experiment-end-date" />
</>
)
}