How to deal with daylight savings here?

Hello,

IM reading from a api and try to convert the data object to a datetime string like this :

(ns toy-project1.subs
  (:require
   [re-frame.core :as re-frame]
   [cljs-time.coerce :as timec]))

(re-frame/reg-sub
 ::time
(fn [db] (timec/to-string (timec/from-long  (* 1000 (get-in db [:weather :current :dt]))))))

but now I see that the code displays 19:21 where the real timeis 20:21.

Is there a way I can solve this ?

Roelof

I wonder if it’s not a timezone thing. Are you in UTC+1 by any chance?

Can also be the problem. Im on Europe/Amsterdam (CET)

Not super au fait with these libs but you could try:

(require '[cljs.time.core :as ctc])
(ctc/to-default-time-zone dt)

now the page is totally white with no error messages when I try this :


(re-frame/reg-sub
 ::time
(fn [db] (ctc/to-default-time-zone (get-in db [:weather :current :dt]))))

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.