common: add fullTime helper

This commit is contained in:
David Sevilla Martin 2020-03-11 18:04:14 -04:00
parent 6a67167eed
commit d6b07153ec
No known key found for this signature in database
GPG Key ID: F764F1417E16B15F

View File

@ -0,0 +1,16 @@
/**
* The `fullTime` helper displays a formatted time string wrapped in a <time>
* tag.
*/
export default function fullTime(time: Date) {
const mo = dayjs(time);
const datetime = mo.format();
const full = mo.format('LLLL');
return (
<time pubdate datetime={datetime}>
{full}
</time>
);
}