about summary refs log tree commit diff
path: root/users/grfn/bbbg/src/bbbg/util/display.clj
blob: 79bd9808874d5794c15428487392e23b7a627409 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(ns bbbg.util.display
  (:require
   [bbbg.util.time :as t])
  (:import
   [java.time.format DateTimeFormatter FormatStyle]))

(defn format-date
  ([d] (format-date d FormatStyle/MEDIUM))
  ([d ^FormatStyle format-style]
   (let [formatter (DateTimeFormatter/ofLocalizedDate format-style)]
     (.format (t/->LocalDate d) formatter))))

(comment
  (format-date #inst "2021-12-19T05:00:00.000-00:00")
  (format-date #inst "2021-12-19T05:00:00.000-00:00"
               FormatStyle/SHORT)
  )