juxt

2019-08-07T15:20:39.019700Z

@doglooksgood I also noticed that I need a locale package to do any formatting, but then I found the Intl.DateTimeFormat browser api that solved it in a for me better way.

(defn intl-format
  "Format dates with the Intl.DateTimeFormat browser API"
  [locale options date]
  (.format (js/Intl.DateTimeFormat. locale (clj->js options))
           (t/inst date)))
(intl-format "sv-SE" {:weekday "long" :year "numeric" :month "short" :day "numeric"} dt)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat

tianshu 2019-08-07T15:21:26.020400Z

@maxt Hi, what is the Intl.DateTimeFormat?

2019-08-07T15:23:42.020800Z

@doglooksgood See updated message (I hit enter to early)

tianshu 2019-08-07T15:28:55.021400Z

thanks for the example!

tianshu 2019-08-07T15:29:22.021900Z

Why Intl.DateTimeFormat can be used for js-joda?

2019-08-07T15:33:03.023100Z

It's only for inst. I simply convert js-joda times to inst with (t/inst dt) before passing it to Intl.DateTimeFormat.

tianshu 2019-08-07T15:53:06.023400Z

@maxt Thanks!

👍 1