mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
common: add fullTime helper
This commit is contained in:
parent
6a67167eed
commit
d6b07153ec
16
js/src/common/helpers/fullTime.tsx
Normal file
16
js/src/common/helpers/fullTime.tsx
Normal 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>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user