Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

AB testing date picker fix

Marcus Farrell95ab4281f173
diff --git a/apps/web/ui/modals/link-builder/ab-testing-modal.tsx b/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
index 2d0f95b7d7..5cc5cca0f4 100644
--- a/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
+++ b/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
@@ -54,6 +54,7 @@ function ABTestingModal({
setShowABTestingModal: Dispatch<SetStateAction<boolean>>;
}) {
const id = useId();
+ const inputRef = useRef<HTMLInputElement>(null);
const {
watch: watchParent,
@@ -400,6 +401,7 @@ function ABTestingModal({
</div>
<div className="mt-2 flex w-full items-center justify-between rounded-md border border-neutral-300 bg-white shadow-sm transition-all focus-within:border-neutral-800 focus-within:outline-none focus-within:ring-1 focus-within:ring-neutral-500">
<input
+ ref={inputRef}
id={`${id}-testCompletedAt`}
type="text"
placeholder='E.g. "in 2 weeks" or "next month"'
@@ -433,6 +435,9 @@ function ABTestingModal({
setValue("testCompletedAt", completeDate, {
shouldDirty: true,
});
+ if (inputRef.current) {
+ inputRef.current.value = formatDateTime(completeDate);
+ }
}}
className="w-[40px] border-none bg-transparent text-neutral-500 focus:outline-none focus:ring-0 sm:text-sm"
/>
diff --git a/apps/web/ui/modals/link-builder/ab-testing/ab-testing-modal.tsx b/apps/web/ui/modals/link-builder/ab-testing/ab-testing-modal.tsx
index 33a73fb1e0..8efffaae3d 100644
--- a/apps/web/ui/modals/link-builder/ab-testing/ab-testing-modal.tsx
+++ b/apps/web/ui/modals/link-builder/ab-testing/ab-testing-modal.tsx
@@ -34,6 +34,7 @@ import {
useCallback,
useId,
useMemo,
+ useRef,
useState,
} from "react";
import { useForm, useFormContext } from "react-hook-form";
@@ -91,6 +92,7 @@ function ABTestingEdit({
setShowABTestingModal: Dispatch<SetStateAction<boolean>>;
}) {
const id = useId();
+ const inputRef = useRef<HTMLInputElement>(null);
const {
watch: watchParent,
@@ -442,6 +444,7 @@ function ABTestingEdit({
</div>
<div className="mt-2 flex w-full items-center justify-between rounded-md border border-neutral-300 bg-white shadow-sm transition-all focus-within:border-neutral-800 focus-within:outline-none focus-within:ring-1 focus-within:ring-neutral-500">
<input
+ ref={inputRef}
id={`${id}-testCompletedAt`}
type="text"
placeholder='E.g. "in 2 weeks" or "next month"'
@@ -475,6 +478,9 @@ function ABTestingEdit({
setValue("testCompletedAt", completeDate, {
shouldDirty: true,
});
+ if (inputRef.current) {
+ inputRef.current.value = formatDateTime(completeDate);
+ }
}}
className="w-[40px] border-none bg-transparent text-neutral-500 focus:outline-none focus:ring-0 sm:text-sm"
/>