about summary refs log tree commit diff
path: root/bskyembed/src/utils.ts
blob: 3408fcd97afe396926cf67dadfa3d91617b4cf92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 {
  return uri.split('/').pop() as string
}