Show absolute time on hover

This commit is contained in:
Fraser 2023-01-29 16:06:44 -05:00
parent 40d8f91115
commit d32f87110d
1 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,8 @@ export interface NoteTimeProps {
export default function NoteTime(props: NoteTimeProps) {
const [time, setTime] = useState<string>();
const { from, fallback } = props;
const absoluteTime = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'long'}).format(from);
const isoDate = new Date(from).toISOString();
function calcTime() {
let fromDate = new Date(from);
@ -46,5 +48,5 @@ export default function NoteTime(props: NoteTimeProps) {
return () => clearInterval(t);
}, [from]);
return <>{time}</>
return <time dateTime={isoDate} title={absoluteTime}>{time}</time>
}