Skip to content

Commit 0d60d53

Browse files
committed
Optionally don’t show the date tooltip. Defaults to true (always show)
1 parent 6da02ac commit 0d60d53

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

apps/webapp/app/components/primitives/DateTime.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type DateTimeProps = {
1212
includeSeconds?: boolean;
1313
includeTime?: boolean;
1414
showTimezone?: boolean;
15+
showTooltip?: boolean;
1516
previousDate?: Date | string | null; // Add optional previous date for comparison
1617
};
1718

@@ -21,6 +22,7 @@ export const DateTime = ({
2122
includeSeconds = true,
2223
includeTime = true,
2324
showTimezone = false,
25+
showTooltip = true,
2426
}: DateTimeProps) => {
2527
const locales = useLocales();
2628
const [localTimeZone, setLocalTimeZone] = useState<string>("UTC");
@@ -74,24 +76,22 @@ export const DateTime = ({
7476
</div>
7577
);
7678

77-
return (
78-
<SimpleTooltip
79-
button={
80-
<Fragment>
81-
{formatDateTime(
82-
realDate,
83-
timeZone ?? localTimeZone,
84-
locales,
85-
includeSeconds,
86-
includeTime
87-
).replace(/\s/g, String.fromCharCode(32))}
88-
{showTimezone ? ` (${timeZone ?? "UTC"})` : null}
89-
</Fragment>
90-
}
91-
content={tooltipContent}
92-
side="right"
93-
/>
79+
const formattedDateTime = (
80+
<Fragment>
81+
{formatDateTime(
82+
realDate,
83+
timeZone ?? localTimeZone,
84+
locales,
85+
includeSeconds,
86+
includeTime
87+
).replace(/\s/g, String.fromCharCode(32))}
88+
{showTimezone ? ` (${timeZone ?? "UTC"})` : null}
89+
</Fragment>
9490
);
91+
92+
if (!showTooltip) return formattedDateTime;
93+
94+
return <SimpleTooltip button={formattedDateTime} content={tooltipContent} side="right" />;
9595
};
9696

9797
export function formatDateTime(

0 commit comments

Comments
 (0)