The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
formatDateTimeSmart
Steven Tey85fdec79cab2
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsxindex 17f0880528..c3a7f79072 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx@@ -126,7 +126,7 @@ export function CustomerPageClient() {/>}<div className="min-w-0">- <span className="block truncate text-base text-xs font-semibold leading-tight text-neutral-900">+ <span className="block truncate text-xs font-semibold leading-tight text-neutral-900">{customer.partner.name}</span>diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.tsindex f079766d06..9f61463afc 100644--- a/apps/web/lib/analytics/get-analytics.ts+++ b/apps/web/lib/analytics/get-analytics.ts@@ -102,6 +102,12 @@ export const getAnalytics = async (params: AnalyticsFilters) => {: analyticsResponse[groupBy],});+ console.log({+ ...params,+ groupBy,+ event,+ });+const response = await pipe({...params,...(UTM_TAGS_PLURAL_LIST.includes(groupBy)diff --git a/apps/web/ui/customers/customer-activity-list.tsx b/apps/web/ui/customers/customer-activity-list.tsxindex 6b9c7d0323..596057de88 100644--- a/apps/web/ui/customers/customer-activity-list.tsx+++ b/apps/web/ui/customers/customer-activity-list.tsx@@ -1,7 +1,7 @@import { CustomerActivityResponse } from "@/lib/types";import { LinkLogo } from "@dub/ui";import { CursorRays, MoneyBill2, UserCheck } from "@dub/ui/icons";-import { getApexDomain, getPrettyUrl } from "@dub/utils";+import { formatDateTimeSmart, getApexDomain, getPrettyUrl } from "@dub/utils";import Link from "next/link";import { useParams } from "next/navigation";@@ -67,19 +67,6 @@ export function CustomerActivityList({<ul className="flex flex-col gap-5 text-sm">{activity.events.map((event, index, events) => {const isLast = index === events.length - 1;- const timestamp = new Date(event.timestamp);-- const month = timestamp.toLocaleDateString("en-US", {- month: "short",- day: "numeric",- });-- const time = timestamp.toLocaleTimeString("en-US", {- hour: "numeric",- minute: "numeric",- hour12: true,- });-const { icon: Icon, content } = activityData[event.event];return (@@ -93,7 +80,7 @@ export function CustomerActivityList({<div className="flex min-w-0 flex-col gap-x-4 gap-y-1 whitespace-nowrap text-sm text-neutral-800 lg:grow lg:flex-row lg:justify-between"><div className="truncate">{content(event)}</div><span className="shrink-0 truncate text-sm text-neutral-500">- {month}, {time}+ {formatDateTimeSmart(event.timestamp)}</span></div></li>diff --git a/apps/web/ui/customers/customer-partner-earnings-table.tsx b/apps/web/ui/customers/customer-partner-earnings-table.tsxindex a5c93b160c..81da8bb979 100644--- a/apps/web/ui/customers/customer-partner-earnings-table.tsx+++ b/apps/web/ui/customers/customer-partner-earnings-table.tsx@@ -1,6 +1,6 @@import { CommissionResponse } from "@/lib/types";import { StatusBadge } from "@dub/ui";-import { currencyFormatter } from "@dub/utils";+import { currencyFormatter, formatDateTimeSmart } from "@dub/utils";import {flexRender,getCoreRowModel,@@ -28,17 +28,7 @@ export function CustomerPartnerEarningsTable({accessorFn: (d) => new Date(d.createdAt),enableHiding: false,minSize: 100,- cell: ({ getValue }) => (- <span>- {getValue().toLocaleTimeString("en-US", {- month: "short",- day: "numeric",- hour: "numeric",- minute: "numeric",- hour12: true,- })}- </span>- ),+ cell: ({ getValue }) => <span>{formatDateTimeSmart(getValue())}</span>,},{header: "Sale Amount",diff --git a/apps/web/ui/customers/customer-sales-table.tsx b/apps/web/ui/customers/customer-sales-table.tsxindex 4d24dc50d9..4ee6916146 100644--- a/apps/web/ui/customers/customer-sales-table.tsx+++ b/apps/web/ui/customers/customer-sales-table.tsx@@ -1,6 +1,6 @@import { PartnerEarningsResponse, SaleEvent } from "@/lib/types";import { StatusBadge } from "@dub/ui";-import { currencyFormatter } from "@dub/utils";+import { currencyFormatter, formatDateTimeSmart } from "@dub/utils";import {flexRender,getCoreRowModel,@@ -40,17 +40,7 @@ export function CustomerSalesTable({new Date("timestamp" in d ? d.timestamp : d.createdAt),enableHiding: false,minSize: 100,- cell: ({ getValue }) => (- <span>- {getValue().toLocaleTimeString("en-US", {- month: "short",- day: "numeric",- hour: "numeric",- minute: "numeric",- hour12: true,- })}- </span>- ),+ cell: ({ getValue }) => <span>{formatDateTimeSmart(getValue())}</span>,},...(sales?.length && "eventName" in sales?.[0]? [