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.

feat(insights): New date picker experiment (#70672)

Sam Pennington7228e4b0d24c
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index c558885d89ba..d243b9d3bd7a 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -1680,6 +1680,14 @@ snapshots:
hash: v1.k794b7964.86233b37a6cc52075154629e5928f1275aee531631d9b24361eae0baa0b5b410.Q9aiFd3--I5oh5C9ZT0J5z4nUm4Odk93VqtpXWUYzRc
components-property-key-info--property-key-info--light:
hash: v1.k794b7964.2f0245e1b92aba6695884bdf695034bf1efd85caca619940965a08338f15e41c.5Z7YHy2M9ko_15_blb0NaI7WmQeXytUWAntBAs03Qr0
+ components-quill-date-filter--date-filter--dark:
+ hash: v1.k794b7964.95c2626b3630789e4e2d50e6e7b079f9ef08687394eb554aa9b71b63c49013ba.G6jYIZtuERuM2gcpHIzsC0DnqeyFryQvG3ufGAwtDN4
+ components-quill-date-filter--date-filter--light:
+ hash: v1.k794b7964.3261cd882abf712af7f05888ef57f337a983d63a9e40007c793f679feeb54d68.26SGhF1NywF2el4OTnoRoh4fzLlUC2HheCjzewhbHGs
+ components-quill-date-filter--date-filter-with-calendar--dark:
+ hash: v1.k794b7964.869925bf268235bb1467d6b353cac80309d09185974f2391bf7d130103dc0e5d.UxBOD2PzL78buiHJ446jBawmOlPZpkKJ5veB_O2zBLU
+ components-quill-date-filter--date-filter-with-calendar--light:
+ hash: v1.k794b7964.9fa65c1b62ed4d859d76a51e976ffa1124ab08aa126e0b63df08e073fc7fc88e.TDqRiHTtDbBkR9Xh3n9PB1j5YXXlgMQ9WR3to-A4QVo
components-sample-data-state--all-variants--dark:
hash: v1.k794b7964.f07ee511a2c77a4ff5a2ed0ca5030e3e57656ade775012ea85bd9c5047f29d3f.297btInaIUjNnmRtmJbS5ZyTmlux9j6wO8NlDAevNzo
components-sample-data-state--all-variants--light:
diff --git a/frontend/src/lib/components/DateFilter/DateFilterExclusionsControl.tsx b/frontend/src/lib/components/DateFilter/DateFilterExclusionsControl.tsx
new file mode 100644
index 000000000000..f7707bf6d49b
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/DateFilterExclusionsControl.tsx
@@ -0,0 +1,142 @@
+import { IconChevronRight } from '@posthog/icons'
+import {
+ Button,
+ Label,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Separator,
+ Switch,
+ ToggleGroup,
+ ToggleGroupItem,
+} from '@posthog/quill'
+
+import type { DataAttributeProps } from 'lib/components/DateFilter/DateRangePresetsPanel'
+
+/** Exclusions footer row for the quill DateTimePicker's presets panel: a flyout with an
+ * incomplete-period switch and exclude-day chips. Speaks _excluded_ ISO days ('1'–'7'). */
+
+export interface DateFilterExclusions {
+ days: string[]
+ incomplete: boolean
+}
+
+export function dateFilterExclusionParts({ days, incomplete }: DateFilterExclusions): string[] {
+ const parts: string[] = []
+ if (days.length > 0) {
+ const sorted = [...days].sort().join(',')
+ if (sorted === '6,7') {
+ parts.push('weekends')
+ } else if (sorted === '1,2,3,4,5') {
+ parts.push('weekdays')
+ } else {
+ parts.push(`${days.length} ${days.length === 1 ? 'day' : 'days'}`)
+ }
+ }
+ if (incomplete) {
+ parts.push('incomplete')
+ }
+ return parts
+}
+
+export function dateFilterExclusionsSummary(exclusions: DateFilterExclusions): string {
+ const parts = dateFilterExclusionParts(exclusions)
+ return parts.length > 0 ? `Excluding ${parts.join(', ')}` : ''
+}
+
+const DAY_LABELS: Record<string, string> = {
+ 1: 'M',
+ 2: 'T',
+ 3: 'W',
+ 4: 'T',
+ 5: 'F',
+ 6: 'S',
+ 7: 'S',
+}
+
+export function DateFilterExclusionsControl({
+ exclusions,
+ onChange,
+ showDays,
+ showIncomplete,
+ panelProps,
+}: {
+ exclusions: DateFilterExclusions
+ onChange: (exclusions: DateFilterExclusions) => void
+ showDays: boolean
+ showIncomplete: boolean
+ panelProps?: DataAttributeProps
+}): JSX.Element {
+ const summary = dateFilterExclusionsSummary(exclusions)
+ return (
+ <Popover>
+ <PopoverTrigger
+ render={<Button variant="default" size="sm" left className="w-full" />}
+ data-attr="date-filter-exclusions"
+ >
+ {summary || 'Exclude'}
+ <IconChevronRight className="ms-auto" />
+ </PopoverTrigger>
+ <PopoverContent side="right" align="end" {...panelProps} className="w-64 gap-0 p-0">
+ {showIncomplete && (
+ <div className="flex items-center justify-between gap-2 px-3 py-2.5">
+ <Label htmlFor="date-filter-exclude-incomplete">Incomplete period</Label>
+ <Switch
+ id="date-filter-exclude-incomplete"
+ size="sm"
+ checked={exclusions.incomplete}
+ onCheckedChange={(incomplete) => onChange({ ...exclusions, incomplete })}
+ />
+ </div>
+ )}
+ {showIncomplete && showDays && <Separator />}
+ {showDays && (
+ <div className="flex flex-col gap-2 px-3 py-2.5">
+ <ToggleGroup
+ multiple
+ size="sm"
+ spacing={1}
+ className="w-full"
+ value={exclusions.days}
+ onValueChange={(days) => onChange({ ...exclusions, days })}
+ >
+ {Object.keys(DAY_LABELS).map((day) => (
+ <ToggleGroupItem
+ key={day}
+ value={day}
+ className="flex-1 data-[pressed]:border-primary data-[pressed]:bg-primary/10 data-[pressed]:text-primary"
+ aria-label={`Exclude day ${day}`}
+ >
+ {DAY_LABELS[day]}
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
+ <div className="flex items-center justify-center gap-3">
+ <Button
+ variant="link-muted"
+ size="xs"
+ onClick={() => onChange({ ...exclusions, days: ['6', '7'] })}
+ >
+ Weekends
+ </Button>
+ <Button
+ variant="link-muted"
+ size="xs"
+ onClick={() => onChange({ ...exclusions, days: ['1', '2', '3', '4', '5'] })}
+ >
+ Weekdays
+ </Button>
+ <Button
+ variant="link-muted"
+ size="xs"
+ onClick={() => onChange({ ...exclusions, days: [] })}
+ >
+ Clear
+ </Button>
+ </div>
+ </div>
+ )}
+ </PopoverContent>
+ </Popover>
+ )
+}
diff --git a/frontend/src/lib/components/DateFilter/DateRangePresetsPanel.tsx b/frontend/src/lib/components/DateFilter/DateRangePresetsPanel.tsx
new file mode 100644
index 000000000000..d82868fe72de
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/DateRangePresetsPanel.tsx
@@ -0,0 +1,245 @@
+import { IconChevronRight } from '@posthog/icons'
+import {
+ Button,
+ cn,
+ CUSTOM_RANGE,
+ Text,
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+ type DateTimeValue,
+} from '@posthog/quill'
+
+import { dayjs, type Dayjs } from 'lib/dayjs'
+import { startOfWeek } from 'lib/utils/dateFilters'
+
+import { RelativeRangeInput, type RelativeRangeUnit, type RelativeRangeValue } from './RelativeRangeInput'
+
+/** The badge presets panel for the quill DateTimePicker, composed app-side while the design is
+ * experimental. The panel never interprets selections — hosts map them to their own range model. */
+
+export type DateRangeSelection =
+ | { kind: 'rolling'; count: number; unit: RelativeRangeUnit }
+ | { kind: 'fixed'; name: string }
+ | { kind: 'custom'; start: Date; end: Date; includesTime?: boolean }
+
+type PresetSelection = Extract<DateRangeSelection, { kind: 'rolling' } | { kind: 'fixed' }>
+
+export interface DateRangeChip {
+ label: string
+ selection: PresetSelection
+}
+
+/** Portaled surfaces escape wrapper-scoped selectors, so skin opt-in rides in as data attributes. */
+export type DataAttributeProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>
+
+const DEFAULT_SHORT_CHIPS: DateRangeChip[] = [
+ { label: '1h', selection: { kind: 'rolling', count: 1, unit: 'hours' } },
+ { label: '24h', selection: { kind: 'rolling', count: 24, unit: 'hours' } },
+ { label: '7d', selection: { kind: 'rolling', count: 7, unit: 'days' } },
+ { label: '14d', selection: { kind: 'rolling', count: 14, unit: 'days' } },
+ { label: '30d', selection: { kind: 'rolling', count: 30, unit: 'days' } },
+ { label: '90d', selection: { kind: 'rolling', count: 90, unit: 'days' } },
+ { label: '1w', selection: { kind: 'rolling', count: 1, unit: 'weeks' } },
+ { label: '1m', selection: { kind: 'rolling', count: 1, unit: 'months' } },
+ { label: '1y', selection: { kind: 'rolling', count: 1, unit: 'years' } },
+]
+const DEFAULT_NAMED_CHIPS = ['Today', 'Yesterday', 'This week', 'This month', 'Year to date', 'All time']
+
+export function dateRangeSelectionLabel(selection: DateRangeSelection): string {
+ if (selection.kind === 'rolling') {
+ const unit = selection.count === 1 ? selection.unit.slice(0, -1) : selection.unit
+ return `Last ${selection.count} ${unit}`
+ }
+ if (selection.kind === 'fixed') {
+ return selection.name
+ }
+ return `${dayjs(selection.start).format('MMM D')} – ${dayjs(selection.end).format('MMM D')}`
+}
+
+function rollingStart(count: number, unit: RelativeRangeUnit, now: Dayjs): Dayjs {
+ return now.subtract(count, unit)
+}
+
+// "All time" has no real start — seed the calendar with a span long enough to look unbounded.
+const ALL_TIME_SEED_YEARS = 10
+
+function fixedRange(name: string, now: Dayjs, weekStartsOn: 0 | 1): { start: Dayjs; end: Dayjs } {
+ switch (name) {
+ case 'Today':
+ return { start: now.startOf('day'), end: now }
+ case 'Yesterday':
+ return { start: now.subtract(1, 'day').startOf('day'), end: now.subtract(1, 'day').endOf('day') }
+ case 'This week':
+ return { start: startOfWeek(now, weekStartsOn), end: now }
+ case 'Last week': {
+ const start = startOfWeek(now.subtract(1, 'week'), weekStartsOn)
+ return { start, end: start.add(6, 'days').endOf('day') }
+ }
+ case 'This month':
+ return { start: now.startOf('month'), end: now }
+ case 'Last month':
+ return { start: now.subtract(1, 'month').startOf('month'), end: now.subtract(1, 'month').endOf('month') }
+ case 'Year to date':
+ return { start: now.startOf('year'), end: now }
+ default:
+ return { start: now.subtract(ALL_TIME_SEED_YEARS, 'years'), end: now }
+ }
+}
+
+export function valueForSelection(selection: DateRangeSelection, now: Dayjs, weekStartsOn: 0 | 1): DateTimeValue {
+ if (selection.kind === 'custom') {
+ return { start: selection.start, end: selection.end, range: CUSTOM_RANGE }
+ }
+ if (selection.kind === 'rolling') {
+ return {
+ start: rollingStart(selection.count, selection.unit, now).toDate(),
+ end: now.toDate(),
+ range: CUSTOM_RANGE,
+ }
+ }
+ const { start, end } = fixedRange(selection.name, now, weekStartsOn)
+ return { start: start.toDate(), end: end.toDate(), range: CUSTOM_RANGE }
+}
+
+export function selectionKeyOf(selection: DateRangeSelection): string {
+ if (selection.kind === 'custom') {
+ return `custom-${selection.start.getTime()}-${selection.end.getTime()}`
+ }
+ if (selection.kind === 'rolling') {
+ return `rolling-${selection.count}-${selection.unit}`
+ }
+ return `fixed-${selection.name}`
+}
+
+const CHIP_CLASSES =
+ 'h-6 px-1.5 text-[0.75rem] border-border bg-transparent aria-selected:border-primary aria-selected:bg-primary/10 aria-selected:font-semibold aria-selected:text-primary'
+
+function chipSelected(chip: PresetSelection, selection: DateRangeSelection): boolean {
+ if (chip.kind === 'rolling') {
+ return selection.kind === 'rolling' && selection.count === chip.count && selection.unit === chip.unit
+ }
+ return selection.kind === 'fixed' && selection.name === chip.name
+}
+
+function chipTitle(chip: PresetSelection, now: Dayjs, weekStartsOn: 0 | 1): string {
+ if (chip.kind === 'rolling') {
+ return `${rollingStart(chip.count, chip.unit, now).format('MMM D, YYYY')} – now`
+ }
+ const { start, end } = fixedRange(chip.name, now, weekStartsOn)
+ return `${start.format('MMM D, YYYY')} – ${end.format('MMM D, YYYY')}`
+}
+
+export interface DateRangePresetsPanelProps {
+ selection: DateRangeSelection
+ onSelectionChange?: (selection: DateRangeSelection) => void
+ shortChips?: DateRangeChip[]
+ namedChips?: string[]
+ /** Frozen "now" shared with the calendar seed so chip titles and the seed agree. */
+ now: Dayjs
+ weekStartsOn: 0 | 1
+ calendarOpen: boolean
+ onCalendarOpenChange?: (open: boolean) => void
+ footer?: React.ReactNode
+ portalProps?: DataAttributeProps
+}
+
+export function DateRangePresetsPanel({
+ selection,
+ onSelectionChange,
+ shortChips = DEFAULT_SHORT_CHIPS,
+ namedChips = DEFAULT_NAMED_CHIPS,
+ now,
+ weekStartsOn,
+ calendarOpen,
+ onCalendarOpenChange,
+ footer,
+ portalProps,
+}: DateRangePresetsPanelProps): JSX.Element {
+ const rolling: RelativeRangeValue =
+ selection.kind === 'rolling' ? { count: selection.count, unit: selection.unit } : { count: 7, unit: 'days' }
+
+ return (
+ <TooltipProvider delay={1000} timeout={0}>
+ <div className="flex h-full w-56 shrink-0 flex-col">
+ <div className="grid grid-cols-3 gap-1 px-2 pt-2 pb-1.5">
+ {shortChips.map(({ label, selection: chip }) => (
+ <Tooltip key={label}>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="outline"
+ size="sm"
+ className={CHIP_CLASSES}
+ aria-selected={chipSelected(chip, selection)}
+ onClick={() => onSelectionChange?.(chip)}
+ data-attr={`date-presets-chip-${label.toLowerCase()}`}
+ />
+ }
+ >
+ {label}
+ </TooltipTrigger>
+ <TooltipContent {...portalProps}>{chipTitle(chip, now, weekStartsOn)}</TooltipContent>
+ </Tooltip>
+ ))}
+ </div>
+ <div className="flex flex-wrap items-center gap-1.5 px-2 py-1.5">
+ <Text size="sm" className="whitespace-nowrap" render={<span />}>
+ Last
+ </Text>
+ <RelativeRangeInput
+ className="gap-1.5 [&_[data-slot=input-group]]:w-[5.5rem] [&_[data-slot=input-group]_input]:px-0"
+ value={rolling}
+ onChange={({ count, unit }) => onSelectionChange?.({ kind: 'rolling', count, unit })}
+ selectContentProps={portalProps}
+ />
+ </div>
+ <div className="grid grid-cols-2 gap-1 px-2 pt-1.5 pb-2">
+ {namedChips.map((name) => (
+ <Tooltip key={name}>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="outline"
+ size="sm"
+ className={CHIP_CLASSES}
+ aria-selected={selection.kind === 'fixed' && selection.name === name}
+ onClick={() => onSelectionChange?.({ kind: 'fixed', name })}
+ data-attr={`date-presets-chip-${name.toLowerCase().replace(/\s+/g, '-')}`}
+ />
+ }
+ >
+ {name}
+ </TooltipTrigger>
+ <TooltipContent {...portalProps}>
+ {chipTitle({ kind: 'fixed', name }, now, weekStartsOn)}
+ </TooltipContent>
+ </Tooltip>
+ ))}
+ </div>
+ {(onCalendarOpenChange || footer) && (
+ <div className="mt-auto flex flex-col gap-px border-t border-border p-1">
+ {onCalendarOpenChange && (
+ <Button
+ variant="default"
+ size="sm"
+ left
+ className="w-full"
+ aria-expanded={calendarOpen}
+ onClick={() => onCalendarOpenChange(!calendarOpen)}
+ data-attr="date-presets-custom-range"
+ >
+ Custom range…
+ <IconChevronRight
+ className={cn('ms-auto transition-transform', calendarOpen && 'rotate-90')}
+ />
+ </Button>
+ )}
+ {footer}
+ </div>
+ )}
+ </div>
+ </TooltipProvider>
+ )
+}
diff --git a/frontend/src/lib/components/DateFilter/QuillDateFilter.stories.tsx b/frontend/src/lib/components/DateFilter/QuillDateFilter.stories.tsx
new file mode 100644
index 000000000000..0cd126503a59
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/QuillDateFilter.stories.tsx
@@ -0,0 +1,136 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { within } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
+import { type ReactNode, useState } from 'react'
+
+import { IconInfo } from '@posthog/icons'
+import {
+ Button as QuillButton,
+ Label as QuillLabel,
+ Switch as QuillSwitch,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import {
+ DateFilterExclusionsControl,
+ dateFilterExclusionParts,
+ type DateFilterExclusions,
+} from './DateFilterExclusionsControl'
+import { dateRangeSelectionLabel, type DataAttributeProps, type DateRangeSelection } from './DateRangePresetsPanel'
+import { QuillDateFilter } from './QuillDateFilter'
+
+// The experimental chip-based date filter, twice: under the lemon skin (lemon-skin.scss rebinds
+// quill under `data-lemon-skin` — same code, lemon look) and quill-native. The panel is rendered
+// inline (not behind the popover) so snapshots capture the actual filter UI.
+
+const meta: Meta = {
+ title: 'Components/Quill Date Filter',
+ parameters: {
+ mockDate: '2026-07-13',
+ },
+}
+export default meta
+type Story = StoryObj
+
+function ConceptColumn({ title, children }: { title: string; children: ReactNode }): JSX.Element {
+ return (
+ <div className="flex flex-col gap-2">
+ <span className="text-xs font-semibold text-secondary">{title}</span>
+ {children}
+ </div>
+ )
+}
+
+function shortExclusionsLabel(parts: string[]): string {
+ return parts.length > 1 ? `excl. ${parts[0]} +${parts.length - 1}` : `excl. ${parts[0]}`
+}
+
+function DateFilterConcept({ lemonSkin }: { lemonSkin?: boolean }): JSX.Element {
+ const [selection, setSelection] = useState<DateRangeSelection>({ kind: 'rolling', count: 30, unit: 'days' })
+ const [exclusions, setExclusions] = useState<DateFilterExclusions>({ days: [], incomplete: false })
+ const [exactTime, setExactTime] = useState(false)
+ const exclusionParts = dateFilterExclusionParts(exclusions)
+ const skinProps = lemonSkin ? { 'data-lemon-skin': true, 'data-quill': true } : { 'data-quill': true }
+ const portalProps = lemonSkin ? ({ 'data-lemon-skin': 'true' } as DataAttributeProps) : undefined
+ return (
+ <div className="flex flex-col items-start gap-3" {...skinProps}>
+ <QuillButton variant="outline">
+ {dateRangeSelectionLabel(selection)}
+ {exclusionParts.length > 0 && (
+ <span className="text-muted-foreground font-normal">· {shortExclusionsLabel(exclusionParts)}</span>
+ )}
+ </QuillButton>
+ <QuillDateFilter
+ selection={selection}
+ onSelectionChange={setSelection}
+ onApplyCustom={setSelection}
+ portalProps={portalProps}
+ presetsFooter={
+ <>
+ <div className="flex h-8 items-center justify-between gap-2 px-2">
+ <QuillLabel htmlFor="date-filter-exact-time" className="flex items-center gap-1">
+ Exact time range
+ <Tooltip>
+ <TooltipTrigger render={<span className="inline-flex" />}>
+ <IconInfo className="h-4 w-4 text-muted-foreground" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-64 flex-col items-start whitespace-normal">
+ <span>
+ When enabled: uses the current time for period boundaries instead of full
+ days.
+ </span>
+ <span>
+ When disabled: dates are rounded to full day periods (start and end of day).
+ </span>
+ </TooltipContent>
+ </Tooltip>
+ </QuillLabel>
+ <QuillSwitch
+ id="date-filter-exact-time"
+ size="sm"
+ checked={exactTime}
+ onCheckedChange={setExactTime}
+ />
+ </div>
+ <DateFilterExclusionsControl
+ exclusions={exclusions}
+ onChange={setExclusions}
+ showDays
+ showIncomplete
+ panelProps={portalProps}
+ />
+ </>
+ }
+ />
+ </div>
+ )
+}
+
+function ConceptGrid(): JSX.Element {
+ return (
+ <div className="flex flex-wrap items-start gap-8">
+ <ConceptColumn title="Date filter · lemon skin">
+ <DateFilterConcept lemonSkin />
+ </ConceptColumn>
+ <ConceptColumn title="Date filter · quill">
+ <DateFilterConcept />
+ </ConceptColumn>
+ </div>
+ )
+}
+
+export const DateFilter: Story = {
+ render: () => <ConceptGrid />,
+}
+
+export const DateFilterWithCalendar: Story = {
+ render: () => <ConceptGrid />,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ for (const row of await canvas.findAllByText('Custom range…')) {
+ await userEvent.click(row)
+ }
+ },
+}
diff --git a/frontend/src/lib/components/DateFilter/QuillDateFilter.tsx b/frontend/src/lib/components/DateFilter/QuillDateFilter.tsx
new file mode 100644
index 000000000000..3bdf3f6198a0
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/QuillDateFilter.tsx
@@ -0,0 +1,101 @@
+import { useMemo, useState } from 'react'
+
+import { DateTimePicker, Label, Switch } from '@posthog/quill'
+
+import { dayjs } from 'lib/dayjs'
+
+import {
+ DateRangePresetsPanel,
+ selectionKeyOf,
+ valueForSelection,
+ type DataAttributeProps,
+ type DateRangeChip,
+ type DateRangeSelection,
+} from './DateRangePresetsPanel'
+
+export interface QuillDateFilterProps {
+ selection: DateRangeSelection
+ /** Chip and stepper picks — immediate, not staged. */
+ onSelectionChange: (selection: DateRangeSelection) => void
+ /** Calendar Apply — `includesTime` reflects the "Include time" toggle. */
+ onApplyCustom: (selection: Extract<DateRangeSelection, { kind: 'custom' }>) => void
+ shortChips?: DateRangeChip[]
+ namedChips?: string[]
+ weekStartsOn?: 0 | 1
+ presetsFooter?: React.ReactNode
+ portalProps?: DataAttributeProps
+}
+
+/** The experimental chip-based date filter: the presets panel beside a stock quill DateTimePicker,
+ * with the calendar collapsed behind the panel's "Custom range…" row. Composed app-side so the
+ * design system stays untouched while this is an experiment. */
+export function QuillDateFilter({
+ selection,
+ onSelectionChange,
+ onApplyCustom,
+ shortChips,
+ namedChips,
+ weekStartsOn = 1,
+ presetsFooter,
+ portalProps,
+}: QuillDateFilterProps): JSX.Element {
+ const [calendarOpen, setCalendarOpen] = useState(false)
+ const [includeTime, setIncludeTime] = useState(false)
+
+ const selectionKey = selectionKeyOf(selection)
+ // Frozen per selection so chip titles and the calendar seed agree across re-renders.
+ const now = useMemo(() => dayjs(), [selectionKey]) // eslint-disable-line react-hooks/exhaustive-deps
+
+ return (
+ <div
+ className="flex w-max overflow-hidden rounded-lg bg-card text-foreground shadow-md ring-1 ring-foreground/10"
+ data-attr="quill-date-filter"
+ >
+ <DateRangePresetsPanel
+ selection={selection}
+ onSelectionChange={onSelectionChange}
+ shortChips={shortChips}
+ namedChips={namedChips}
+ now={now}
+ weekStartsOn={weekStartsOn}
+ calendarOpen={calendarOpen}
+ onCalendarOpenChange={setCalendarOpen}
+ portalProps={portalProps}
+ footer={
+ <>
+ {calendarOpen && (
+ <div className="flex h-8 items-center justify-between gap-2 px-2">
+ <Label htmlFor="date-filter-include-time">Include time</Label>
+ <Switch
+ id="date-filter-include-time"
+ size="sm"
+ checked={includeTime}
+ onCheckedChange={setIncludeTime}
+ />
+ </div>
+ )}
+ {presetsFooter}
+ </>
+ }
+ />
+ {calendarOpen && (
+ <DateTimePicker
+ // The picker stages from `value` at mount only — remount to reseed
+ key={`${selectionKey}-${includeTime ? 'time' : 'day'}`}
+ ranges={[]}
+ showHeader={false}
+ showTime={includeTime}
+ weekStartsOn={weekStartsOn}
+ value={valueForSelection(selection, now, weekStartsOn)}
+ onApply={({ start, end }) => {
+ onApplyCustom({ kind: 'custom', start, end, includesTime: includeTime })
+ setCalendarOpen(false)
+ }}
+ onCancel={() => setCalendarOpen(false)}
+ // flex-col + separator mt-auto pin Cancel/Apply to the bottom when the panel is taller
+ className="flex shrink-0 flex-col rounded-none border-l border-border shadow-none ring-0 lg:w-auto [&>[data-slot=separator]]:mt-auto"
+ />
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/lib/components/DateFilter/RelativeRangeInput.tsx b/frontend/src/lib/components/DateFilter/RelativeRangeInput.tsx
new file mode 100644
index 000000000000..a1566abf84d6
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/RelativeRangeInput.tsx
@@ -0,0 +1,105 @@
+import { IconMinus, IconPlus } from '@posthog/icons'
+import {
+ cn,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupButton,
+ InputGroupNumberInput,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@posthog/quill'
+
+export type RelativeRangeUnit = 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years'
+
+export interface RelativeRangeValue {
+ count: number
+ unit: RelativeRangeUnit
+}
+
+export interface RelativeRangeInputProps {
+ value: RelativeRangeValue
+ onChange: (value: RelativeRangeValue) => void
+ units?: RelativeRangeUnit[]
+ min?: number
+ max?: number
+ className?: string
+ /** Extra props for the unit dropdown surface (portaled to <body>) — e.g. skin opt-in data attributes. */
+ selectContentProps?: React.HTMLAttributes<HTMLDivElement>
+}
+
+const DEFAULT_UNITS: RelativeRangeUnit[] = ['hours', 'days', 'weeks', 'months', 'years']
+
+function unitLabel(unit: RelativeRangeUnit, count: number): string {
+ return count === 1 ? unit.slice(0, -1) : unit
+}
+
+/** A "N units" duration control: stepper + unit dropdown. The host provides surrounding
+ * words ("Last …") and maps the value to its own range vocabulary. */
+export function RelativeRangeInput({
+ value,
+ onChange,
+ units = DEFAULT_UNITS,
+ min = 1,
+ max = 999,
+ className,
+ selectContentProps,
+}: RelativeRangeInputProps): JSX.Element {
+ const clamp = (n: number): number => Math.min(max, Math.max(min, n))
+ const setCount = (count: number | null): void => {
+ if (count !== null && !Number.isNaN(count)) {
+ onChange({ ...value, count: clamp(count) })
+ }
+ }
+
+ return (
+ <div className={cn('flex items-center gap-2', className)}>
+ <InputGroup className="w-28">
+ <InputGroupAddon align="inline-start">
+ <InputGroupButton
+ size="icon-xs"
+ aria-label="Decrease"
+ disabled={value.count <= min}
+ onClick={() => setCount(value.count - 1)}
+ >
+ <IconMinus />
+ </InputGroupButton>
+ </InputGroupAddon>
+ <InputGroupNumberInput
+ aria-label="Count"
+ value={value.count}
+ min={min}
+ max={max}
+ onValueChange={setCount}
+ />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ size="icon-xs"
+ aria-label="Increase"
+ disabled={value.count >= max}
+ onClick={() => setCount(value.count + 1)}
+ >
+ <IconPlus />
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ <Select
+ value={value.unit}
+ onValueChange={(unit) => onChange({ ...value, unit: unit as RelativeRangeUnit })}
+ >
+ <SelectTrigger size="sm" className="w-auto gap-1" aria-label="Unit">
+ <SelectValue>{(unit: RelativeRangeUnit) => unitLabel(unit, value.count)}</SelectValue>
+ </SelectTrigger>
+ <SelectContent {...selectContentProps}>
+ {units.map((unit) => (
+ <SelectItem key={unit} value={unit}>
+ {unitLabel(unit, value.count)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )
+}
diff --git a/frontend/src/lib/components/DateFilter/dateRangeSelection.test.ts b/frontend/src/lib/components/DateFilter/dateRangeSelection.test.ts
new file mode 100644
index 000000000000..680cb0781a78
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/dateRangeSelection.test.ts
@@ -0,0 +1,76 @@
+import { dateRangeForSelection, selectionForDateRange } from './dateRangeSelection'
+
+describe('date range selection mapping', () => {
+ // Persisted PostHog strings must round-trip exactly — a drift here rewrites saved queries.
+ it.each([
+ ['-7d', null, { kind: 'rolling', count: 7, unit: 'days' }],
+ ['-24h', null, { kind: 'rolling', count: 24, unit: 'hours' }],
+ ['-1w', null, { kind: 'rolling', count: 1, unit: 'weeks' }],
+ ['-1m', null, { kind: 'rolling', count: 1, unit: 'months' }],
+ ['-1y', null, { kind: 'rolling', count: 1, unit: 'years' }],
+ ['dStart', null, { kind: 'fixed', name: 'Today' }],
+ ['-1dStart', '-1dEnd', { kind: 'fixed', name: 'Yesterday' }],
+ ['-1mStart', '-1mEnd', { kind: 'fixed', name: 'Last month' }],
+ ['wStart', null, { kind: 'fixed', name: 'This week' }],
+ ['mStart', null, { kind: 'fixed', name: 'This month' }],
+ ['yStart', null, { kind: 'fixed', name: 'Year to date' }],
+ ['all', null, { kind: 'fixed', name: 'All time' }],
+ ] as const)('round-trips %s / %s', (dateFrom, dateTo, expected) => {
+ const selection = selectionForDateRange(dateFrom, dateTo)
+ expect(selection).toEqual(expected)
+ expect(dateRangeForSelection(selection)).toEqual({ date_from: dateFrom, date_to: dateTo })
+ })
+
+ // Strings the picker can't express must resolve to concrete custom ranges via the
+ // canonical parser — never be mislabeled as a fabricated preset like "Last 7 days".
+ it.each([
+ ['-2q', null], // quarters, emitted by the classic rolling filter
+ ['-30M', null], // uppercase-M minutes, the interval=second default
+ ['-2mStart', null], // Start-anchored string not present in dateMapping
+ ['-30d', '-7d'], // relative pair defeats the rolling guard
+ ] as const)('resolves unrepresentable %s / %s to a custom range', (dateFrom, dateTo) => {
+ const selection = selectionForDateRange(dateFrom, dateTo)
+ expect(selection.kind).toBe('custom')
+ const custom = selection as Extract<typeof selection, { kind: 'custom' }>
+ expect(custom.start.getTime()).toBeLessThan(custom.end.getTime())
+ })
+
+ it('quarters resolve to roughly the right span, not a 7-day fabrication', () => {
+ const selection = selectionForDateRange('-2q', null)
+ expect(selection.kind).toBe('custom')
+ const custom = selection as Extract<typeof selection, { kind: 'custom' }>
+ const days = (custom.end.getTime() - custom.start.getTime()) / 86_400_000
+ expect(days).toBeGreaterThan(170)
+ expect(days).toBeLessThan(190)
+ })
+
+ it('maps concrete dates to a custom selection and keeps date-only serialization without time', () => {
+ const selection = selectionForDateRange('2026-07-01', '2026-07-10')
+ expect(selection.kind).toBe('custom')
+ expect(dateRangeForSelection(selection)).toEqual({
+ date_from: '2026-07-01',
+ date_to: '2026-07-10',
+ })
+ })
+
+ it('serializes times without touching explicitDate when the selection includes time', () => {
+ const selection = {
+ kind: 'custom' as const,
+ start: new Date(2026, 6, 1, 9, 30),
+ end: new Date(2026, 6, 1, 17, 0),
+ includesTime: true,
+ }
+ expect(dateRangeForSelection(selection)).toEqual({
+ date_from: '2026-07-01T09:30:00',
+ date_to: '2026-07-01T17:00:00',
+ })
+ })
+
+ it('falls back to a concrete last-7-days custom range for unparseable input', () => {
+ const selection = selectionForDateRange('garbage', null)
+ expect(selection.kind).toBe('custom')
+ const custom = selection as Extract<typeof selection, { kind: 'custom' }>
+ const days = (custom.end.getTime() - custom.start.getTime()) / 86_400_000
+ expect(days).toBeCloseTo(7, 0)
+ })
+})
diff --git a/frontend/src/lib/components/DateFilter/dateRangeSelection.ts b/frontend/src/lib/components/DateFilter/dateRangeSelection.ts
new file mode 100644
index 000000000000..86fbcef7d440
--- /dev/null
+++ b/frontend/src/lib/components/DateFilter/dateRangeSelection.ts
@@ -0,0 +1,67 @@
+import type { DateRangeSelection } from 'lib/components/DateFilter/DateRangePresetsPanel'
+import type { RelativeRangeUnit } from 'lib/components/DateFilter/RelativeRangeInput'
+import { dayjs } from 'lib/dayjs'
+import { dateMapping, dateStringToDayJs } from 'lib/utils/dateFilters'
+
+import type { DateRange } from '~/queries/schema/schema-general'
+
+// Only the units the picker's rolling input speaks; everything else (quarters, minutes,
+// seconds, Start/End anchors) resolves to a concrete custom range below.
+const ROLLING_DATE_FROM = /^-(\d+)([hdwmy])$/
+const UNIT_BY_LETTER: Record<string, RelativeRangeUnit> = {
+ h: 'hours',
+ d: 'days',
+ w: 'weeks',
+ m: 'months',
+ y: 'years',
+}
+const LETTER_BY_UNIT: Record<RelativeRangeUnit, string> = {
+ minutes: 'h', // not offered in the picker; mapped defensively
+ hours: 'h',
+ days: 'd',
+ weeks: 'w',
+ months: 'm',
+ years: 'y',
+}
+
+/** PostHog relative-date strings → a picker selection. Named periods resolve through
+ * `dateMapping`, so the picker's chip names and the query vocabulary can't drift. Anything
+ * the picker can't express (quarters, minute ranges, Start/End anchors, relative pairs)
+ * resolves through the canonical parser to a concrete custom range — never a fabricated preset. */
+export function selectionForDateRange(dateFrom: string, dateTo: string | null | undefined): DateRangeSelection {
+ const rolling = !dateTo && dateFrom.match(ROLLING_DATE_FROM)
+ if (rolling) {
+ return { kind: 'rolling', count: parseInt(rolling[1], 10), unit: UNIT_BY_LETTER[rolling[2]] }
+ }
+ const named = dateMapping.find(({ values }) => values[0] === dateFrom && (values[1] ?? null) === (dateTo ?? null))
+ if (named) {
+ return { kind: 'fixed', name: named.key }
+ }
+ const start = dateStringToDayJs(dateFrom) ?? (dayjs(dateFrom).isValid() ? dayjs(dateFrom) : null)
+ const end = dateTo ? (dateStringToDayJs(dateTo) ?? (dayjs(dateTo).isValid() ? dayjs(dateTo) : null)) : dayjs()
+ if (start) {
+ return { kind: 'custom', start: start.toDate(), end: (end ?? dayjs()).toDate() }
+ }
+ return { kind: 'custom', start: dayjs().subtract(7, 'day').toDate(), end: dayjs().toDate() }
+}
+
+function formatCustomDate(date: Date, includesTime: boolean): string {
+ return dayjs(date).format(includesTime ? 'YYYY-MM-DDTHH:mm:ss' : 'YYYY-MM-DD')
+}
+
+export function dateRangeForSelection(selection: DateRangeSelection): Partial<DateRange> {
+ if (selection.kind === 'rolling') {
+ return { date_from: `-${selection.count}${LETTER_BY_UNIT[selection.unit]}`, date_to: null }
+ }
+ if (selection.kind === 'fixed') {
+ const named = dateMapping.find(({ key }) => key === selection.name)
+ return { date_from: named?.values[0] ?? null, date_to: named?.values[1] ?? null }
+ }
+ // explicitDate is deliberately not written: like the legacy filter, applying a range
+ // never touches the "Exact time range" toggle — only the toggle itself does.
+ const includesTime = !!selection.includesTime
+ return {
+ date_from: formatCustomDate(selection.start, includesTime),
+ date_to: formatCustomDate(selection.end, includesTime),
+ }
+}
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 9a343c5a7616..c535ede2aa4c 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -427,6 +427,7 @@ export const FEATURE_FLAGS = {
PRODUCT_ANALYTICS_INSIGHT_HORIZONTAL_CONTROLS: 'insight-horizontal-controls', // owner: #team-product-analytics
PRODUCT_ANALYTICS_PATHS_V2: 'paths-v2', // owner: @thmsobrmlr #team-product-analytics
PRODUCT_ANALYTICS_QUARTER_YEAR_INTERVALS: 'product-analytics-quarter-year-intervals', // owner: @sampennington #team-product-analytics, gates quarter/year interval selection on insights
+ PRODUCT_ANALYTICS_QUILL_DATE_FILTER: 'product-analytics-quill-date-filter', // owner: @sampennington #team-product-analytics, swaps the insight date filter for the chip-based quill date filter (lemon-skinned)
PRODUCT_ANALYTICS_QUILL_LEGEND: 'product-analytics-quill-legend', // owner: #team-product-analytics, gates the in-chart quill legend replacing the legacy side InsightLegend
PRODUCT_ANALYTICS_QUILL_SQL_CHARTS: 'product-analytics-quill-sql-charts', // owner: #team-data-tools, gates rendering DataVisualization line/area charts via @posthog/quill-charts
PRODUCT_ANALYTICS_RETENTION_AGGREGATION: 'retention-aggregation', // owner: @anirudhpillai #team-product-analytics
diff --git a/frontend/src/lib/utils/dateFilters.ts b/frontend/src/lib/utils/dateFilters.ts
index 74b5e7a5260a..6810b07a5380 100644
--- a/frontend/src/lib/utils/dateFilters.ts
+++ b/frontend/src/lib/utils/dateFilters.ts
@@ -6,7 +6,7 @@ import { UnexpectedNeverError } from 'lib/utils/guards'
import { DateMappingOption, IntervalType } from '~/types'
/** Returns the start of the current week, respecting the team's week start day (0=Sunday, 1=Monday). */
-function startOfWeek(date: dayjs.Dayjs, weekStartDay?: number | null): dayjs.Dayjs {
+export function startOfWeek(date: dayjs.Dayjs, weekStartDay?: number | null): dayjs.Dayjs {
const start = weekStartDay === 1 ? 1 : 0
return date.subtract((date.day() - start + 7) % 7, 'day').startOf('day')
}
diff --git a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
index 51cef0bac5d6..7ee8604897aa 100644
--- a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
+++ b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx
@@ -7,11 +7,13 @@ import { LemonButton } from '@posthog/lemon-ui'
import { ChartFilter } from 'lib/components/ChartFilter'
import { CompareFilter } from 'lib/components/CompareFilter/CompareFilter'
import { IntervalFilter } from 'lib/components/IntervalFilter'
-import { NON_TIME_SERIES_DISPLAY_TYPES } from 'lib/constants'
+import { FEATURE_FLAGS, NON_TIME_SERIES_DISPLAY_TYPES } from 'lib/constants'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { alignResolvedDateRangeToInterval, formatResolvedDateRange } from 'lib/utils/datetime'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { InsightDateFilter } from 'scenes/insights/filters/InsightDateFilter'
+import { InsightQuillDateFilter } from 'scenes/insights/filters/InsightDateFilter/InsightQuillDateFilter'
import { RetentionChartPicker } from 'scenes/insights/filters/RetentionChartPicker'
import { insightLogic } from 'scenes/insights/insightLogic'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
@@ -69,6 +71,8 @@ export function InsightDisplayConfig(): JSX.Element {
((isTrends || isStickiness) && !(display && NON_TIME_SERIES_DISPLAY_TYPES.includes(display)))
const { items: advancedOptions, count: advancedOptionsCount } = useInsightDisplayOptions()
+ const { featureFlags } = useValues(featureFlagLogic)
+ const useQuillDateFilter = !!featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_QUILL_DATE_FILTER]
return (
<div
@@ -78,7 +82,11 @@ export function InsightDisplayConfig(): JSX.Element {
<div className="flex items-center gap-x-2 flex-wrap gap-y-2">
{!isRetention && (
<ConfigFilter>
- <InsightDateFilter disabled={isFunnels && !!isEmptyFunnel} />
+ {useQuillDateFilter ? (
+ <InsightQuillDateFilter disabled={isFunnels && !!isEmptyFunnel} />
+ ) : (
+ <InsightDateFilter disabled={isFunnels && !!isEmptyFunnel} />
+ )}
</ConfigFilter>
)}
@@ -172,5 +180,5 @@ export function InsightDisplayConfig(): JSX.Element {
}
function ConfigFilter({ children }: { children: ReactNode }): JSX.Element {
- return <span className="deprecated-space-x-2 flex items-center text-sm">{children}</span>
+ return <span className="flex items-center gap-x-2 text-sm">{children}</span>
}
diff --git a/frontend/src/queries/nodes/InsightViz/InsightResultMetadata.tsx b/frontend/src/queries/nodes/InsightViz/InsightResultMetadata.tsx
index b3ff1852534f..a93b0233195b 100644
--- a/frontend/src/queries/nodes/InsightViz/InsightResultMetadata.tsx
+++ b/frontend/src/queries/nodes/InsightViz/InsightResultMetadata.tsx
@@ -2,6 +2,7 @@ import { useValues } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { daysOfWeekLabel, getExcludedDaysOfWeek } from 'scenes/insights/filters/InsightDateFilter/daysOfWeekFilterUtils'
import { insightLogic } from 'scenes/insights/insightLogic'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
@@ -17,8 +18,15 @@ export const InsightResultMetadata = ({
disableLastComputationRefresh,
}: InsightResultMetadataProps): JSX.Element => {
const { insightProps } = useValues(insightLogic)
- const { samplingFactor, trendsFilter } = useValues(insightVizDataLogic(insightProps))
+ const { samplingFactor, trendsFilter, dateRange, isTrends } = useValues(insightVizDataLogic(insightProps))
const { featureFlags } = useValues(featureFlagLogic)
+
+ const quillDateFilterEnabled = !!featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_QUILL_DATE_FILTER]
+ // Only trends applies daysOfWeek server-side, so only trends gets the note
+ const excludedDays = quillDateFilterEnabled && isTrends ? getExcludedDaysOfWeek(dateRange) : []
+ const excludedLabel = daysOfWeekLabel(excludedDays)
+ const excludedText = ['Weekends', 'Weekdays'].includes(excludedLabel) ? excludedLabel.toLowerCase() : excludedLabel
+
return (
<>
{!disableLastComputation && <ComputationTimeWithRefresh disableRefresh={disableLastComputationRefresh} />}
@@ -28,12 +36,24 @@ export const InsightResultMetadata = ({
Results calculated from {samplingFactor * 100}% of users
</span>
) : null}
+ {excludedDays.length > 0 ? (
+ <span className="text-secondary">
+ <span className="mx-1">•</span>
+ Excluding {excludedText}
+ </span>
+ ) : null}
{trendsFilter?.hideWeekends && featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_HIDE_WEEKENDS] ? (
<span className="text-secondary">
<span className="mx-1">•</span>
Weekends hidden
</span>
) : null}
+ {quillDateFilterEnabled && dateRange?.excludeIncompletePeriods ? (
+ <span className="text-secondary">
+ <span className="mx-1">•</span>
+ Incomplete period excluded
+ </span>
+ ) : null}
</>
)
}
diff --git a/frontend/src/scenes/insights/filters/InsightDateFilter/InsightQuillDateFilter.tsx b/frontend/src/scenes/insights/filters/InsightDateFilter/InsightQuillDateFilter.tsx
new file mode 100644
index 000000000000..16de5f1e51e2
--- /dev/null
+++ b/frontend/src/scenes/insights/filters/InsightDateFilter/InsightQuillDateFilter.tsx
@@ -0,0 +1,186 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useState } from 'react'
+
+import { IconCalendar, IconInfo } from '@posthog/icons'
+import {
+ Button,
+ Label,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Switch,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import {
+ DateFilterExclusionsControl,
+ dateFilterExclusionParts,
+ type DateFilterExclusions,
+} from 'lib/components/DateFilter/DateFilterExclusionsControl'
+import { selectionKeyOf, type DateRangeSelection } from 'lib/components/DateFilter/DateRangePresetsPanel'
+import { dateRangeForSelection, selectionForDateRange } from 'lib/components/DateFilter/dateRangeSelection'
+import { QuillDateFilter } from 'lib/components/DateFilter/QuillDateFilter'
+import { dateFilterToText, dateMapping } from 'lib/utils/dateFilters'
+import { insightLogic } from 'scenes/insights/insightLogic'
+import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { computeDaysOfWeekUpdate, getExcludedDaysOfWeek, type IsoDayOfWeek } from './daysOfWeekFilterUtils'
+
+// Chip labels double as dateMapping keys; filter at module load so a renamed chip can never
+// silently produce the wrong range.
+const NAMED_CHIPS = ['Today', 'Yesterday', 'This week', 'This month', 'Year to date', 'All time'].filter((name) =>
+ dateMapping.some(({ key }) => key === name)
+)
+
+function shortExclusionsLabel(parts: string[]): string {
+ return parts.length > 1 ? `excl. ${parts[0]} +${parts.length - 1}` : `excl. ${parts[0]}`
+}
+
+const LEMON_SKIN_PROPS = { 'data-lemon-skin': 'true' }
+
+type InsightQuillDateFilterProps = {
+ disabled: boolean
+}
+
+export function InsightQuillDateFilter({ disabled }: InsightQuillDateFilterProps): JSX.Element {
+ const { insightProps, editingDisabledReason } = useValues(insightLogic)
+ const { dateRange, trendsFilter, isTrends, isRetention } = useValues(insightVizDataLogic(insightProps))
+ const { updateDateRange, updateQuerySource } = useActions(insightVizDataLogic(insightProps))
+ const { weekStartDay } = useValues(teamLogic)
+ const [open, setOpen] = useState(false)
+
+ const storeSelection = selectionForDateRange(dateRange?.date_from ?? '-7d', dateRange?.date_to)
+ // The store updates only after the logic's 300ms debounce — reflect picks immediately
+ // so rapid stepper presses accumulate instead of re-deriving from a stale value.
+ const [pendingSelection, setPendingSelection] = useState<DateRangeSelection | null>(null)
+ const storeSelectionKey = selectionKeyOf(storeSelection)
+ useEffect(() => {
+ setPendingSelection(null)
+ }, [storeSelectionKey])
+ const selection = pendingSelection ?? storeSelection
+ const triggerLabel =
+ dateFilterToText(dateRange?.date_from ?? '-7d', dateRange?.date_to, 'Last 7 days', dateMapping, false) ??
+ 'Last 7 days'
+
+ // The picker speaks excluded days; the query schema stores included days. The legacy
+ // display-only trendsFilter.hideWeekends is deliberately NOT folded in — different semantics.
+ const excludedDays = getExcludedDaysOfWeek(dateRange)
+ // The backend rejects daysOfWeek together with smoothing, so don't offer it
+ const smoothingActive = isTrends && (trendsFilter?.smoothingIntervals ?? 1) > 1
+ const showExcludedDays = isTrends && !smoothingActive
+ const showIncompletePeriod = !isRetention
+
+ // Hiding the exclusions control (smoothing turned on, or the insight type changed away from
+ // trends) must also clear any daysOfWeek already on the query — otherwise it lingers with no
+ // UI left to remove it, and the backend rejects daysOfWeek alongside smoothing.
+ useEffect(() => {
+ if (!showExcludedDays && dateRange?.daysOfWeek?.length) {
+ updateQuerySource(computeDaysOfWeekUpdate([], dateRange))
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [showExcludedDays])
+ const exclusions: DateFilterExclusions = {
+ days: isTrends ? excludedDays.map(String) : [],
+ incomplete: !isRetention && !!dateRange?.excludeIncompletePeriods,
+ }
+ const handleExclusionsChange = (next: DateFilterExclusions): void => {
+ if (isTrends && next.days.join(',') !== exclusions.days.join(',')) {
+ updateQuerySource(computeDaysOfWeekUpdate(next.days.map(Number) as IsoDayOfWeek[], dateRange))
+ }
+ if (!isRetention && next.incomplete !== exclusions.incomplete) {
+ updateDateRange({ excludeIncompletePeriods: next.incomplete ? true : null }, true)
+ }
+ }
+
+ const exclusionParts = dateFilterExclusionParts(exclusions)
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger
+ render={
+ <Button
+ variant="outline"
+ data-quill
+ data-lemon-skin
+ disabled={disabled || !!editingDisabledReason}
+ title={editingDisabledReason ?? undefined}
+ data-attr="insight-quill-date-filter"
+ />
+ }
+ >
+ <IconCalendar />
+ {triggerLabel}
+ {exclusionParts.length > 0 && (
+ <span className="text-muted-foreground font-normal">· {shortExclusionsLabel(exclusionParts)}</span>
+ )}
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ collisionAvoidance={{ side: 'flip', align: 'shift', fallbackAxisSide: 'none' }}
+ className="w-auto overflow-hidden border-none p-0 shadow-none ring-0"
+ {...LEMON_SKIN_PROPS}
+ >
+ <QuillDateFilter
+ selection={selection}
+ onSelectionChange={(next) => {
+ setPendingSelection(next)
+ // Rolling changes ride the stepper click-by-click, so let them debounce
+ updateDateRange(dateRangeForSelection(next), next.kind !== 'rolling')
+ if (next.kind !== 'rolling') {
+ setOpen(false)
+ }
+ }}
+ onApplyCustom={(next) => {
+ updateDateRange(dateRangeForSelection(next), true)
+ setOpen(false)
+ }}
+ namedChips={NAMED_CHIPS}
+ weekStartsOn={weekStartDay === 1 ? 1 : 0}
+ portalProps={LEMON_SKIN_PROPS}
+ presetsFooter={
+ <>
+ <div className="flex h-8 items-center justify-between gap-2 px-2">
+ <Label htmlFor="date-filter-exact-time" className="flex items-center gap-1">
+ Exact time range
+ <Tooltip>
+ <TooltipTrigger render={<span className="inline-flex" />}>
+ <IconInfo className="h-4 w-4 text-muted-foreground" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-64 flex-col items-start whitespace-normal">
+ <span>
+ When enabled: uses the current time for period boundaries instead of
+ full days.
+ </span>
+ <span>
+ When disabled: dates are rounded to full day periods (start and end of
+ day).
+ </span>
+ </TooltipContent>
+ </Tooltip>
+ </Label>
+ <Switch
+ id="date-filter-exact-time"
+ size="sm"
+ checked={dateRange?.explicitDate ?? false}
+ onCheckedChange={(checked) => updateDateRange({ explicitDate: checked }, true)}
+ />
+ </div>
+ {(showExcludedDays || showIncompletePeriod) && (
+ <DateFilterExclusionsControl
+ exclusions={exclusions}
+ onChange={handleExclusionsChange}
+ showDays={showExcludedDays}
+ showIncomplete={showIncompletePeriod}
+ panelProps={LEMON_SKIN_PROPS}
+ />
+ )}
+ </>
+ }
+ />
+ </PopoverContent>
+ </Popover>
+ )
+}
diff --git a/frontend/src/scenes/insights/filters/InsightDateFilter/daysOfWeekFilterUtils.ts b/frontend/src/scenes/insights/filters/InsightDateFilter/daysOfWeekFilterUtils.ts
new file mode 100644
index 000000000000..71e183327133
--- /dev/null
+++ b/frontend/src/scenes/insights/filters/InsightDateFilter/daysOfWeekFilterUtils.ts
@@ -0,0 +1,57 @@
+import { DateRange, TrendsQuery } from '~/queries/schema/schema-general'
+
+export type IsoDayOfWeek = NonNullable<DateRange['daysOfWeek']>[number]
+
+const DAYS_IN_WEEK = 7
+const WEEKDAYS: IsoDayOfWeek[] = [1, 2, 3, 4, 5]
+const WEEKENDS: IsoDayOfWeek[] = [6, 7]
+const DAY_LABELS: Record<number, string> = {
+ 1: 'Mon',
+ 2: 'Tue',
+ 3: 'Wed',
+ 4: 'Thu',
+ 5: 'Fri',
+ 6: 'Sat',
+ 7: 'Sun',
+}
+
+export const ALL_DAY_NUMBERS: IsoDayOfWeek[] = [1, 2, 3, 4, 5, 6, 7]
+
+function sortDays(days: IsoDayOfWeek[]): IsoDayOfWeek[] {
+ return [...days].sort((a, b) => a - b)
+}
+
+/** [] means all days on both sides of the inversion. */
+export function invertDaysOfWeek(days: IsoDayOfWeek[]): IsoDayOfWeek[] {
+ return days.length === 0 ? [] : ALL_DAY_NUMBERS.filter((day) => !days.includes(day))
+}
+
+/** ISO days (1=Mon…7=Sun) the query filters OUT; [] means nothing is excluded. */
+export function getExcludedDaysOfWeek(dateRange: DateRange | null | undefined): IsoDayOfWeek[] {
+ return dateRange?.daysOfWeek?.length ? invertDaysOfWeek(sortDays(dateRange.daysOfWeek)) : []
+}
+
+export function daysOfWeekLabel(days: IsoDayOfWeek[]): string {
+ if (days.length === 0 || days.length === DAYS_IN_WEEK) {
+ return 'All days'
+ }
+ if (days.length === WEEKDAYS.length && WEEKDAYS.every((day) => days.includes(day))) {
+ return 'Weekdays'
+ }
+ if (days.length === WEEKENDS.length && WEEKENDS.every((day) => days.includes(day))) {
+ return 'Weekends'
+ }
+ return days.map((day) => DAY_LABELS[day]).join(', ')
+}
+
+/** 0 or 7 excluded days normalise to daysOfWeek: null ("all days included"). Deliberately does
+ * not touch the legacy display-only trendsFilter.hideWeekends — its semantics differ (buckets
+ * hidden from the response, events kept in windowed aggregations), so it stays independent. */
+export function computeDaysOfWeekUpdate(
+ excludedDays: IsoDayOfWeek[],
+ dateRange: DateRange | null | undefined
+): Partial<TrendsQuery> {
+ const included = invertDaysOfWeek(excludedDays)
+ const daysOfWeek = included.length === 0 || included.length === DAYS_IN_WEEK ? null : sortDays(included)
+ return { dateRange: { ...dateRange, daysOfWeek } }
+}
diff --git a/frontend/src/styles/global.scss b/frontend/src/styles/global.scss
index de0bb312c5b9..6f0f3003871b 100644
--- a/frontend/src/styles/global.scss
+++ b/frontend/src/styles/global.scss
@@ -13,3 +13,4 @@
@import '../../node_modules/@posthog/quill/dist/base.scoped.css';
@import '../../node_modules/@posthog/quill/dist/primitives.css';
@import 'quill-bridge';
+@import 'lemon-skin';
diff --git a/frontend/src/styles/lemon-skin.scss b/frontend/src/styles/lemon-skin.scss
new file mode 100644
index 000000000000..71b29e49d98d
--- /dev/null
+++ b/frontend/src/styles/lemon-skin.scss
@@ -0,0 +1,433 @@
+/*
+ * PROTOTYPE — Lemon skin for quill: restyles quill primitives to LemonUI's visual
+ * language so quill components drop into Lemon scenes with no visible change.
+ * Opt in per surface with `data-quill data-lemon-skin` on a wrapper. Quill's own
+ * rules live in `@layer components`, so these unlayered overrides win the cascade.
+ * Portaled content (menus, flyouts, dropdowns) escapes the wrapper — pass
+ * `data-lemon-skin` to the quill *Content component so it lands on the portal.
+ */
+
+/* quill-bridge.scss rebinds several Lemon var names to quill tokens inside
+ [data-quill], so these aliases restore the Lemon values under skin-local names. */
+[data-lemon-skin] {
+ --lemon-skin-accent: hsl(
+ var(--color-brand-primary-hue),
+ var(--color-brand-primary-saturation),
+ var(--color-brand-primary-lightness)
+ );
+ --lemon-skin-accent-hover: hsl(
+ var(--color-brand-primary-hue),
+ var(--color-brand-primary-saturation),
+ calc(var(--color-brand-primary-lightness) + 10%)
+ );
+ --lemon-skin-border: var(--color-posthog-3000-200);
+ --lemon-skin-border-hover: var(--color-posthog-3000-400);
+ --lemon-skin-surface: var(--color-white);
+ --lemon-skin-bg-page: var(--color-posthog-3000-50);
+ --lemon-skin-text-secondary: var(--color-neutral-750);
+ --lemon-skin-radius: 0.375rem;
+ --lemon-skin-radius-lg: 0.625rem;
+}
+
+[theme='dark'] [data-lemon-skin] {
+ --lemon-skin-border: var(--color-neutral-cool-800);
+ --lemon-skin-border-hover: var(--color-neutral-cool-600);
+ --lemon-skin-surface: var(--color-neutral-cool-850);
+ --lemon-skin-bg-page: var(--color-neutral-cool-950);
+ --lemon-skin-text-secondary: var(--color-neutral-350);
+}
+
+/* Core quill tokens → Lemon values: recolors primitive CSS and bespoke Tailwind in one
+ place. tokens.scoped.css sets values directly on every [data-quill] element, so the
+ extra selectors are needed to out-specificity it. */
+[data-lemon-skin],
+[data-lemon-skin][data-quill],
+[data-lemon-skin] [data-quill] {
+ --foreground: var(--text-3000);
+ --muted-foreground: var(--lemon-skin-text-secondary);
+ --border: var(--lemon-skin-border);
+ --input: var(--lemon-skin-border);
+ --card: var(--color-bg-surface-popover);
+ --background: var(--lemon-skin-surface);
+ --primary: var(--lemon-skin-accent);
+ --primary-foreground: var(--lemon-skin-surface);
+ --fill-hover: var(--color-bg-fill-button-tertiary-hover);
+ --fill-selected: var(--color-bg-fill-button-tertiary-active);
+ --fill-expanded: var(--color-bg-fill-button-tertiary-active);
+ --radius-xs: 0.25rem;
+ --radius-sm: 0.375rem;
+ --radius-md: 0.375rem;
+ --radius-lg: 0.625rem;
+
+ /* Quill's base 12px text → Lemon's 14px, wherever quill CSS reads the var */
+ --text-xs: 0.875rem;
+ --shadow-md: var(--shadow-elevation-3000);
+}
+
+/* ═══ Button → LemonButton ═════════════════════════════════════════════ */
+
+/* The attribute matches an ancestor (wrapped surfaces, portaled content) or the
+ element itself, so an opted-in inline button is skinned without a wrapper. */
+
+[data-lemon-skin] .quill-button,
+.quill-button[data-lemon-skin] {
+ font-family: var(--font-button);
+ font-size: 0.875rem;
+ font-weight: 500;
+ line-height: 1.5rem;
+ color: var(--text-3000);
+ border-radius: var(--lemon-skin-radius);
+}
+
+/* primary → Lemon primary. LemonButton draws its 3D frame on a pseudo-element inset
+ -1px with `0 3px 0 -1px`; on the button itself 0 spread gives the same net edge. */
+
+[data-lemon-skin] .quill-button--variant-primary,
+.quill-button--variant-primary[data-lemon-skin] {
+ color: var(--text-3000-light);
+ background-color: var(--primary-3000-button-bg);
+ border: 1px solid var(--primary-3000-button-border);
+ box-shadow: 0 0.1875rem 0 0 var(--primary-3000-frame-bg);
+ translate: none;
+}
+
+[data-lemon-skin] .quill-button--variant-primary:not(:disabled, [aria-disabled='true']):hover,
+.quill-button--variant-primary[data-lemon-skin]:not(:disabled, [aria-disabled='true']):hover {
+ background-color: var(--primary-3000-button-bg);
+ border-color: var(--primary-3000-button-border-hover);
+}
+
+[data-lemon-skin] .quill-button--variant-primary:not(:disabled, [aria-disabled='true']):active,
+.quill-button--variant-primary[data-lemon-skin]:not(:disabled, [aria-disabled='true']):active {
+ box-shadow: none;
+ translate: 0 0.1875rem;
+}
+
+/* outline → Lemon secondary */
+
+[data-lemon-skin] .quill-button--variant-outline,
+.quill-button--variant-outline[data-lemon-skin] {
+ background-color: transparent;
+ border: 1px solid var(--secondary-3000-button-border);
+ box-shadow: 0 0.1875rem 0 0 var(--secondary-3000-frame-bg);
+}
+
+[data-lemon-skin] .quill-button--variant-outline:not(:disabled, [aria-disabled='true']):hover,
+.quill-button--variant-outline[data-lemon-skin]:not(:disabled, [aria-disabled='true']):hover {
+ color: var(--text-3000);
+ background-color: transparent;
+ border-color: var(--secondary-3000-button-border-hover);
+}
+
+[data-lemon-skin] .quill-button--variant-outline:not(:disabled, [aria-disabled='true']):active,
+.quill-button--variant-outline[data-lemon-skin]:not(:disabled, [aria-disabled='true']):active {
+ box-shadow: none;
+ translate: 0 0.1875rem;
+}
+
+/* default (ghost) → Lemon tertiary */
+
+[data-lemon-skin] .quill-button--variant-default,
+.quill-button--variant-default[data-lemon-skin] {
+ background-color: transparent;
+ border: none;
+ box-shadow: none;
+}
+
+[data-lemon-skin] .quill-button--variant-default:not(:disabled, [aria-disabled='true']):hover,
+.quill-button--variant-default[data-lemon-skin]:not(:disabled, [aria-disabled='true']):hover {
+ color: var(--text-3000);
+ background-color: var(--color-bg-fill-button-tertiary-hover);
+}
+
+[data-lemon-skin] .quill-button--variant-default:not(:disabled, [aria-disabled='true']):active,
+.quill-button--variant-default[data-lemon-skin]:not(:disabled, [aria-disabled='true']):active {
+ background-color: var(--color-bg-fill-button-tertiary-active);
+}
+
+/* link / link-muted → Lemon Link (accent text, no underline) */
+
+[data-lemon-skin] .quill-button--variant-link,
+[data-lemon-skin] .quill-button--variant-link-muted,
+.quill-button--variant-link[data-lemon-skin],
+.quill-button--variant-link-muted[data-lemon-skin] {
+ height: auto;
+ padding: 0;
+ color: var(--lemon-skin-accent);
+ text-decoration-line: none;
+ background: none;
+ border: none;
+ box-shadow: none;
+}
+
+[data-lemon-skin] .quill-button--variant-link-muted,
+.quill-button--variant-link-muted[data-lemon-skin] {
+ color: var(--text-3000);
+}
+
+[data-lemon-skin]
+ :is(.quill-button--variant-link, .quill-button--variant-link-muted):not(:disabled, [aria-disabled='true']):hover,
+:is(.quill-button--variant-link, .quill-button--variant-link-muted)[data-lemon-skin]:not(
+ :disabled,
+ [aria-disabled='true']
+):hover {
+ color: var(--lemon-skin-accent-hover);
+ text-decoration-line: none;
+ background: none;
+}
+
+/* Sizes → Lemon's scale by closest geometry: xs→xxsmall, sm→xsmall,
+ default→small, lg→medium */
+
+[data-lemon-skin] .quill-button--size-default,
+.quill-button--size-default[data-lemon-skin] {
+ gap: 0.5rem;
+ height: 2.0625rem;
+ padding-inline: 0.5rem;
+ font-size: 0.875rem;
+}
+
+[data-lemon-skin] .quill-button--size-default svg:not([class*='size-']),
+.quill-button--size-default[data-lemon-skin] svg:not([class*='size-']) {
+ width: 1.25rem;
+ height: 1.25rem;
+}
+
+[data-lemon-skin] .quill-button--size-xs,
+.quill-button--size-xs[data-lemon-skin] {
+ gap: 0.1875rem;
+ height: 1.25rem;
+ padding-inline: 0.25rem;
+ font-size: 0.6875rem;
+ border-radius: var(--lemon-skin-radius);
+}
+
+[data-lemon-skin] .quill-button--size-sm,
+.quill-button--size-sm[data-lemon-skin] {
+ gap: 0.25rem;
+ height: 1.625rem;
+ padding-inline: 0.375rem;
+ font-size: 0.75rem;
+}
+
+[data-lemon-skin] .quill-button--size-sm svg:not([class*='size-']),
+.quill-button--size-sm[data-lemon-skin] svg:not([class*='size-']) {
+ width: 0.875rem;
+ height: 0.875rem;
+}
+
+/* ═══ InputGroup (input with addons) — recolor only, keep 2rem metrics ═ */
+
+[data-lemon-skin] .quill-input-group {
+ /* Undo the global --text-xs bump inside the stepper: at 14px a 3-digit count truncates.
+ The text-xs utility reads the var (and is !important), so re-scope the var. */
+ --text-xs: 0.75rem;
+
+ font-family: var(--font-sans);
+ background-color: var(--color-bg-fill-input);
+ border-color: var(--lemon-skin-border);
+ border-radius: var(--lemon-skin-radius);
+}
+
+[data-lemon-skin] .quill-input-group:has([data-slot='input-group-control']:focus-visible) {
+ border-color: var(--lemon-skin-border-hover);
+ box-shadow: none;
+}
+
+/* Buttons inside the group keep quill's compact metrics — the Lemon button remap
+ (2.0625rem, full radius) overflows the 2rem group on hover. */
+[data-lemon-skin] .quill-input-group .quill-button {
+ border-radius: calc(var(--lemon-skin-radius) - 2px);
+}
+
+[data-lemon-skin] .quill-input-group .quill-input-group__button--size-icon-xs {
+ width: 1.5rem;
+ height: 1.5rem;
+ padding: 0;
+}
+
+/* ═══ Switch → LemonSwitch ═════════════════════════════════════════════ */
+
+[data-lemon-skin] .quill-switch {
+ border: none;
+ outline: 1px solid var(--lemon-skin-border);
+}
+
+[data-lemon-skin] .quill-switch[data-unchecked] {
+ background-color: var(--color-bg-fill-switch);
+}
+
+[data-lemon-skin] .quill-switch[data-checked] {
+ background-color: var(--lemon-skin-accent);
+}
+
+[data-lemon-skin] .quill-switch__thumb {
+ /* Lemon hardcodes a white handle in the off state */
+ background-color: #fff;
+}
+
+[data-lemon-skin] .quill-switch[data-checked] .quill-switch__thumb {
+ background-color: var(--lemon-skin-surface);
+ transform: translateX(100%);
+}
+
+/* ═══ Separator → LemonDivider ═════════════════════════════════════════ */
+
+[data-lemon-skin] .quill-separator {
+ background-color: var(--lemon-skin-border);
+}
+
+/* ═══ Label → LemonLabel ═══════════════════════════════════════════════ */
+
+[data-lemon-skin] .quill-label {
+ font-family: var(--font-sans);
+ font-size: 0.875rem;
+ font-weight: 600;
+ line-height: 1.5rem;
+}
+
+/* ═══ Popover / menu / select surfaces → Lemon Popover box ═════════════ */
+
+[data-lemon-skin] :is(.quill-popover__content, .quill-select__content),
+:is(.quill-popover__content, .quill-select__content)[data-lemon-skin] {
+ font-family: var(--font-sans);
+ font-size: 0.875rem;
+ background-color: var(--color-bg-surface-popover);
+ border: 1px solid var(--secondary-3000-button-border);
+ border-radius: var(--lemon-skin-radius-lg);
+ box-shadow: var(--shadow-elevation-3000);
+}
+
+/* SelectTrigger sizes itself via data-size, not Button's size prop: sm → xsmall */
+[data-lemon-skin] .quill-select__trigger[data-size='sm'] {
+ gap: 0.25rem;
+ height: 1.625rem;
+ padding-inline: 0.375rem;
+ font-size: 0.75rem;
+}
+
+/* Select rows sized like the small LemonButtons LemonMenu renders */
+
+[data-lemon-skin] .quill-select__item {
+ height: auto;
+ min-height: 2.0625rem;
+ padding-block: 0.25rem;
+ padding-inline: 0.5rem;
+ font-size: 0.8125rem;
+ font-weight: 500;
+ border-radius: var(--lemon-skin-radius);
+}
+
+[data-lemon-skin] .quill-select__item:focus {
+ background-color: var(--color-bg-fill-button-tertiary-hover);
+}
+
+[data-lemon-skin] .quill-select__item:not(:hover)[aria-selected='true'] {
+ background-color: var(--color-bg-fill-button-tertiary-active);
+}
+
+/* ═══ ToggleGroup → Lemon day chips ════════════════════════════════════ */
+
+/* Items carry quill's toggle classes, whose grey pressed styling leaks through —
+ give each a pressable face with an accent bottom edge, sinking when pressed. */
+
+[data-lemon-skin] .quill-toggle-group__item {
+ font-size: 0.75rem;
+ color: var(--text-3000);
+ background-color: var(--lemon-skin-surface);
+ border: 1px solid var(--lemon-skin-border);
+ border-radius: var(--lemon-skin-radius);
+ box-shadow: 0 0.1875rem 0 0 var(--lemon-skin-accent);
+ translate: none;
+}
+
+[data-lemon-skin] .quill-toggle-group__item:not(:disabled, [aria-disabled='true']):hover {
+ color: var(--text-3000);
+ background-color: var(--lemon-skin-surface);
+ border-color: var(--lemon-skin-border-hover);
+}
+
+/* Selected → pressed: sink onto the accent edge and tint the face */
+
+[data-lemon-skin] .quill-toggle-group__item:is([aria-pressed='true'], [data-pressed], [data-state='on']) {
+ color: var(--lemon-skin-accent);
+ background-color: color-mix(in oklab, var(--lemon-skin-accent) 12%, var(--lemon-skin-surface));
+ border-color: var(--lemon-skin-accent);
+ box-shadow: none;
+ translate: 0 0.1875rem;
+}
+
+/* ═══ DateTimePicker actions footer → small Lemon buttons ══════════════ */
+
+/* Cancel/Apply are quill size=sm; bump them to small Lemon metrics. */
+
+[data-lemon-skin]
+ .quill-button:is([data-attr='date-time-picker-cancel'], [data-attr='date-time-picker-apply-date-range']) {
+ height: 2.0625rem;
+ padding-inline: 0.75rem;
+ font-size: 0.8125rem;
+}
+
+/* ═══ Chip-based date filter surface → Lemon popover chrome ═════════════ */
+
+/* Surface: Lemon popover chrome instead of quill's card ring. */
+[data-lemon-skin] [data-attr='quill-date-filter'] {
+ background: var(--lemon-skin-surface);
+ border: 1px solid var(--lemon-skin-border);
+ border-radius: var(--lemon-skin-radius);
+ box-shadow: var(--shadow-elevation-3000);
+}
+
+/* Chips → LemonTag metrics: flat neutral border, tag-scale type — 16 of Lemon's
+ raised secondary buttons in one grid read as noise. */
+[data-lemon-skin] .quill-button:is([data-attr^='date-presets-chip-']) {
+ height: 1.5rem;
+ padding: 0.125rem 0.375rem;
+ font-size: 0.75rem;
+ font-weight: 500;
+ line-height: 1rem;
+ color: var(--text-3000);
+ background: var(--lemon-skin-surface);
+ border: 1px solid var(--lemon-skin-border);
+ border-radius: 0.25rem;
+ box-shadow: none;
+ translate: none;
+}
+
+[data-lemon-skin] .quill-button:is([data-attr^='date-presets-chip-']):not([aria-selected='true']):hover {
+ background: var(--lemon-skin-surface);
+ border-color: var(--lemon-skin-border-hover);
+ box-shadow: none;
+ translate: none;
+}
+
+/* Selected chip → LemonTag highlight: accent text + border, no fill. */
+[data-lemon-skin] .quill-button:is([data-attr^='date-presets-chip-'])[aria-selected='true'] {
+ color: var(--lemon-skin-accent);
+ background: var(--lemon-skin-surface);
+ border-color: var(--lemon-skin-accent);
+}
+
+/* Footer rows (Custom range… / Exclude) → Lemon menu-row metrics.
+ `height`, not `min-height`: the size-sm variant sets an explicit height that would win. */
+[data-lemon-skin] .quill-button:is([data-attr='date-presets-custom-range'], [data-attr='date-filter-exclusions']) {
+ height: 2.0625rem;
+ padding-inline: 0.5rem;
+ font-size: 0.8125rem;
+}
+
+/* Picker footer band → flat Lemon surface. bg-muted/30 is an !important utility the
+ skin can't outrank, so neutralize the token it mixes from instead. */
+[data-lemon-skin] div:has(> [data-attr='date-time-picker-cancel']) {
+ --muted-3000: transparent;
+
+ background: var(--lemon-skin-surface);
+ border-top: 1px solid var(--lemon-skin-border);
+}
+
+/* Footer switch-row labels → same metrics as the footer button rows (the generic
+ Label→LemonLabel mapping above is 600/14px, too heavy for a menu row). */
+[data-lemon-skin] label:is([for='date-filter-exact-time'], [for='date-filter-include-time']) {
+ font-size: 0.8125rem;
+ font-weight: 500;
+}