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 = {
12
12
includeSeconds ?: boolean ;
13
13
includeTime ?: boolean ;
14
14
showTimezone ?: boolean ;
15
+ showTooltip ?: boolean ;
15
16
previousDate ?: Date | string | null ; // Add optional previous date for comparison
16
17
} ;
17
18
@@ -21,6 +22,7 @@ export const DateTime = ({
21
22
includeSeconds = true ,
22
23
includeTime = true ,
23
24
showTimezone = false ,
25
+ showTooltip = true ,
24
26
} : DateTimeProps ) => {
25
27
const locales = useLocales ( ) ;
26
28
const [ localTimeZone , setLocalTimeZone ] = useState < string > ( "UTC" ) ;
@@ -74,24 +76,22 @@ export const DateTime = ({
74
76
</ div >
75
77
) ;
76
78
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 >
94
90
) ;
91
+
92
+ if ( ! showTooltip ) return formattedDateTime ;
93
+
94
+ return < SimpleTooltip button = { formattedDateTime } content = { tooltipContent } side = "right" /> ;
95
95
} ;
96
96
97
97
export function formatDateTime (
You can’t perform that action at this time.
0 commit comments