File size: 593 Bytes
90723a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export function formatDateTime(input) {
  if (!input) return ''
  const date = input instanceof Date ? input : new Date(input)
  const tz = Intl.DateTimeFormat().resolvedOptions().timeZone
  return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short', timeZone: tz }).format(date)
}

export function formatDate(input) {
  if (!input) return ''
  const date = input instanceof Date ? input : new Date(input)
  const tz = Intl.DateTimeFormat().resolvedOptions().timeZone
  return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeZone: tz }).format(date)
}