4b513a894d
* Don't use very slow dayjs formatter on timestamp tooltips * Kill dead code in feed-bets.tsx * Clean up tooltip markup
26 lines
571 B
TypeScript
26 lines
571 B
TypeScript
import { Tooltip } from './tooltip'
|
|
|
|
const FORMATTER = new Intl.DateTimeFormat('default', {
|
|
dateStyle: 'medium',
|
|
timeStyle: 'long',
|
|
})
|
|
|
|
export function DateTimeTooltip(props: {
|
|
time: number
|
|
text?: string
|
|
className?: string
|
|
children?: React.ReactNode
|
|
noTap?: boolean
|
|
}) {
|
|
const { className, time, text, noTap } = props
|
|
|
|
const formattedTime = FORMATTER.format(time)
|
|
const toolTip = text ? `${text} ${formattedTime}` : formattedTime
|
|
|
|
return (
|
|
<Tooltip className={className} text={toolTip} noTap={noTap}>
|
|
{props.children}
|
|
</Tooltip>
|
|
)
|
|
}
|