Need more datetime detail for Edit History

This commit is contained in:
Lim Chee Aun 2023-03-03 18:11:37 +08:00
parent 7b8c7f3fb6
commit d86a69903f
2 changed files with 10 additions and 2 deletions

View file

@ -1295,7 +1295,14 @@ function EditedAtModal({
return (
<li key={createdAt} class="history-item">
<h3>
<time>{niceDateTime(createdAtDate)}</time>
<time>
{niceDateTime(createdAtDate, {
formatOpts: {
weekday: 'short',
second: 'numeric',
},
})}
</time>
</h3>
<Status
status={status}

View file

@ -1,4 +1,4 @@
function niceDateTime(date, { hideTime } = {}) {
function niceDateTime(date, { hideTime, formatOpts } = {}) {
if (!(date instanceof Date)) {
date = new Date(date);
}
@ -12,6 +12,7 @@ function niceDateTime(date, { hideTime } = {}) {
// Hide time if requested
hour: hideTime ? undefined : 'numeric',
minute: hideTime ? undefined : 'numeric',
...formatOpts,
}).format(date);
return dateText;
}