export default function formatTime (date, displayTime = false) {
  const locale = document.documentElement.lang || navigator.language
  let options = { year: 'numeric', month: 'short', day: 'numeric' }
  if (displayTime) {
    options = { ...options, hour: 'numeric', minute: '2-digit' }
  }
  return date.toLocaleDateString(locale, options)
}
