diff --git a/src/clj/pmagnus/btcdata/web/routes/api.clj b/src/clj/pmagnus/btcdata/web/routes/api.clj index 1a9e051..569db1f 100644 --- a/src/clj/pmagnus/btcdata/web/routes/api.clj +++ b/src/clj/pmagnus/btcdata/web/routes/api.clj @@ -16,6 +16,7 @@ [io.undertow.websockets.core AbstractReceiveListener WebSockets WebSocketChannel] [java.time Instant ZoneId] [java.time.format DateTimeFormatter] + [java.util Locale] [java.util.concurrent LinkedBlockingQueue TimeUnit])) (defn- price->json [{:keys [price prev-price recorded-at]} rates] @@ -27,6 +28,10 @@ :price_dkk (str (.multiply (bigdec price) (:dkk rates))))))) (def ^:private ts-fmt (DateTimeFormatter/ofPattern "dd-MM HH:mm:ss")) +(def ^:private da-locale (Locale. "da" "DK")) + +(defn- da-fmt [fmt val] + (String/format da-locale fmt (into-array Object [val]))) (defn- price->html [{:keys [price prev-price recorded-at]} rates] (let [p (double (bigdec price)) @@ -40,19 +45,19 @@ (str "
$" (format "%,.2f" p) "
" + "$" (da-fmt "%,.2f" p) "
" (when rates (let [eur (double (:eur rates)) dkk (double (:dkk rates)) p-eur (double (.multiply (bigdec price) (:eur rates))) p-dkk (double (.multiply (bigdec price) (:dkk rates)))] (str "Updated " ts "
" "