19 lines
427 B
TypeScript
19 lines
427 B
TypeScript
import {AtUri} from '@atproto/api'
|
|
|
|
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',
|
|
})}`
|
|
}
|
|
|
|
export function getRkey({uri}: {uri: string}): string {
|
|
const at = new AtUri(uri)
|
|
return at.rkey
|
|
}
|