File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
apps/webapp/app/components/primitives Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff 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
9797export function formatDateTime (
You can’t perform that action at this time.
0 commit comments