[APP-611] Add nice date to expanded post view (#567)

* Add nice date to expanded post view

* Fix styles
This commit is contained in:
Paul Frazee 2023-05-02 23:29:16 -05:00 committed by GitHub
parent 6f1c4ec9a9
commit 2eb0d8c095
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -27,3 +27,15 @@ export function ago(date: number | string | Date): string {
return new Date(ts).toLocaleDateString()
}
}
export function niceDate(date: number | string | Date) {
const d = new Date(date)
return `${d.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})} at ${d.toLocaleTimeString(undefined, {
hour: 'numeric',
minute: '2-digit',
})}`
}