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.

formatDateTimeSmart + show <$1 sale amounts

Steven Tey0f4c0ec368ed
diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx
index 4688d812cf..9b3f685fdd 100644
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@ -25,6 +25,7 @@ import {
cn,
currencyFormatter,
fetcher,
+ formatDateTimeSmart,
getApexDomain,
getPrettyUrl,
} from "@dub/utils";
@@ -97,13 +98,7 @@ export default function EventsTable({
})}
>
<div className="w-full truncate">
- {getValue().toLocaleTimeString("en-US", {
- month: "short",
- day: "numeric",
- hour: "numeric",
- minute: "numeric",
- hour12: true,
- })}
+ {formatDateTimeSmart(getValue())}
</div>
</Tooltip>
),
diff --git a/apps/web/ui/links/link-analytics-badge.tsx b/apps/web/ui/links/link-analytics-badge.tsx
index 41e94dcbf4..efeecd9d5e 100644
--- a/apps/web/ui/links/link-analytics-badge.tsx
+++ b/apps/web/ui/links/link-analytics-badge.tsx
@@ -104,7 +104,11 @@ export function LinkAnalyticsBadge({
<div key={tab} className="text-sm leading-none">
<span className="font-medium text-neutral-950">
{tab === "sales"
- ? currencyFormatter(value / 100)
+ ? currencyFormatter(value / 100, {
+ maximumFractionDigits: 2,
+ // @ts-ignore – trailingZeroDisplay is a valid option but TS is outdated
+ trailingZeroDisplay: "stripIfInteger",
+ })
: nFormatter(value, { full: value < INFINITY_NUMBER })}
</span>{" "}
{tab === "sales" ? "total " : ""}
@@ -166,7 +170,11 @@ export function LinkAnalyticsBadge({
/>
<span>
{tab === "sales"
- ? currencyFormatter(value / 100)
+ ? currencyFormatter(value / 100, {
+ maximumFractionDigits: 2,
+ // @ts-ignore – trailingZeroDisplay is a valid option but TS is outdated
+ trailingZeroDisplay: "stripIfInteger",
+ })
: nFormatter(value)}
{stats.length === 1 && " clicks"}
</span>