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 ( return (
<li key={createdAt} class="history-item"> <li key={createdAt} class="history-item">
<h3> <h3>
<time>{niceDateTime(createdAtDate)}</time> <time>
{niceDateTime(createdAtDate, {
formatOpts: {
weekday: 'short',
second: 'numeric',
},
})}
</time>
</h3> </h3>
<Status <Status
status={status} status={status}

View file

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