1
0
ohmyform/ui/components/time.ago.tsx
Michael Schramm 9c4c325e5a
Switch to single branch (#221)
* remove submodules
* add api and ui files
* update github actions
* use sparse checkout
* update node setup
* update checkout
* update docker
* change permissions
* update mariadb health check
* update changelog
2023-12-02 19:22:40 +01:00

26 lines
496 B
TypeScript

import { Tooltip } from 'antd'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import React from 'react'
dayjs.extend(relativeTime)
interface Props {
date: string
}
export const TimeAgo: React.FC<Props> = (props) => {
const date = dayjs(props.date)
return (
<Tooltip title={date.format('YYYY-MM-DD HH:mm:ss')}>
<div
style={{
display: 'inline-block',
}}
>
{date.fromNow()}
</div>
</Tooltip>
)
}