MCPcopy Create free account
hub / github.com/experdot/pointer / DateTimeText

Function DateTimeText

src/renderer/src/components/common/DateTimeText.tsx:13–42  ·  view source on GitHub ↗
({
  value,
  className,
  style,
  tooltip = true,
  emptyText = '-'
}: DateTimeTextProps)

Source from the content-addressed store, hash-verified

11}
12
13export function DateTimeText({
14 value,
15 className,
16 style,
17 tooltip = true,
18 emptyText = '-'
19}: DateTimeTextProps): React.JSX.Element {
20 const date = parseDateLike(value)
21 const mergedStyle = { whiteSpace: 'nowrap', ...style }
22
23 if (!date) {
24 return (
25 <span className={className} style={mergedStyle}>
26 {emptyText}
27 </span>
28 )
29 }
30
31 const content = (
32 <span className={className} style={mergedStyle}>
33 {formatSemanticDateTime(date)}
34 </span>
35 )
36
37 if (!tooltip) {
38 return content
39 }
40
41 return <Tooltip title={formatLongDateTime(date)}>{content}</Tooltip>
42}

Callers

nothing calls this directly

Calls 3

parseDateLikeFunction · 0.90
formatSemanticDateTimeFunction · 0.90
formatLongDateTimeFunction · 0.90

Tested by

no test coverage detected