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(annotations): migrate annotation date marker to the DatePicker seam (#65995)

Paul D'Ambra9c8564cb1891
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 04c6c4b52056..210a2de311cb 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -4740,6 +4740,14 @@ snapshots:
hash: v1.k794b7964.7f0897f6244513270c3398881eda41b7aec7946bea33bf94ad76ddb271478d48.-5xSObBOfpwuWh0DqYlix54-RAG4dXTSSPgMpneXCWo
scenes-app-annotations--annotations--light:
hash: v1.k794b7964.c8d42c54757583ebfb46646ac6b4b91cc96fd674c2c546d618bd9a5965b7fe42.eaBpd1UcxY6uFXw7Uweda56WqjJ9GxnrdHlBmM1KH78
+ scenes-app-annotations--new-annotation-modal-lemon-ui-date-picker--dark:
+ hash: v1.k794b7964.056b9294ed36b17a9d0a34f42f99a81266f04ac1a53c4499d45eccab079eab49.b1Pt6Pw2xqi2si51j__XtHJI0VSRppoPU2wp5ZOvbuI
+ scenes-app-annotations--new-annotation-modal-lemon-ui-date-picker--light:
+ hash: v1.k794b7964.6966de6aa76362c856866a7c03cc659181f9b35c9a7aeed66818bc13d45694de.ZjF9wxmaKG3f37UEx2nBU38qnd_WEyPem9hYB1Fpzg4
+ scenes-app-annotations--new-annotation-modal-quill-date-picker--dark:
+ hash: v1.k794b7964.b944884dfa0cad1d6434d68028981276ae65ba737af88c3ec4824a43aea02273.zJHC5wSgeUR4KYXRKsgL8w7shm1bCl4OqGV_6MKP6X8
+ scenes-app-annotations--new-annotation-modal-quill-date-picker--light:
+ hash: v1.k794b7964.145485776b19a860265cd10b123a12534ba653360376177ed6732bc28f71e6bf.tOieVc4jN5LbkgTFdkj0rwGvr6Yu0KnamwRzckrlLUk
scenes-app-batchexports--backfills-empty--dark:
hash: v1.k794b7964.28507262548478e2d0211783c04f1078475fe387f5540c0b84a5a10bbd1e327d.5iPjqcsujNk379gMnile1JByq6y9F-64wSu3_-x_uQY
scenes-app-batchexports--backfills-empty--light:
diff --git a/frontend/src/scenes/annotations/AnnotationModal.tsx b/frontend/src/scenes/annotations/AnnotationModal.tsx
index b739ca85cbcb..46422021acb0 100644
--- a/frontend/src/scenes/annotations/AnnotationModal.tsx
+++ b/frontend/src/scenes/annotations/AnnotationModal.tsx
@@ -2,17 +2,11 @@ import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { IconX } from '@posthog/icons'
-import {
- LemonButton,
- LemonCalendarSelectInput,
- LemonModal,
- LemonModalProps,
- LemonSelect,
- LemonSelectOptions,
- Link,
-} from '@posthog/lemon-ui'
+import { LemonButton, LemonModal, LemonModalProps, LemonSelect, LemonSelectOptions, Link } from '@posthog/lemon-ui'
+import { DatePicker } from 'lib/components/DatePicker/DatePicker'
import { EmojiPickerPopover } from 'lib/components/EmojiPicker/EmojiPickerPopover'
+import { dayjs } from 'lib/dayjs'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonTextAreaMarkdown } from 'lib/lemon-ui/LemonTextArea/LemonTextAreaMarkdown'
import { shortTimeZone } from 'lib/utils/timezones'
@@ -166,7 +160,14 @@ export function AnnotationModal({
}
className="flex-1"
>
- <LemonCalendarSelectInput granularity="minute" />
+ {({ value, onChange }) => (
+ <DatePicker
+ value={value}
+ onChange={onChange}
+ granularity="minute"
+ maxDate={dayjs().add(1, 'year')}
+ />
+ )}
</LemonField>
<LemonField name="scope" label="Scope" className="flex-1">
<LemonSelect options={scopeOptions} fullWidth />
diff --git a/frontend/src/scenes/annotations/Annotations.stories.tsx b/frontend/src/scenes/annotations/Annotations.stories.tsx
index 731d4b17ab88..7b6e8eeb020f 100644
--- a/frontend/src/scenes/annotations/Annotations.stories.tsx
+++ b/frontend/src/scenes/annotations/Annotations.stories.tsx
@@ -1,5 +1,8 @@
import { Meta, StoryObj } from '@storybook/react'
+import { within } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
+import { FEATURE_FLAGS } from 'lib/constants'
import { App } from 'scenes/App'
import { urls } from 'scenes/urls'
@@ -35,3 +38,17 @@ type Story = StoryObj<{}>
// The table renders the emoji next to the content for annotations that have one (see the fixture),
// giving visual-regression coverage of the emoji display.
export const Annotations: Story = {}
+
+const openNewAnnotationModal: Story['play'] = async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ await userEvent.click(await canvas.findByText('New annotation'))
+}
+
+export const NewAnnotationModalLemonUIDatePicker: Story = {
+ play: openNewAnnotationModal,
+}
+
+export const NewAnnotationModalQuillDatePicker: Story = {
+ parameters: { featureFlags: [FEATURE_FLAGS.QUILL_DATE_PICKER] },
+ play: openNewAnnotationModal,
+}