This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-13
Channels
- # arachne (2)
- # architecture (23)
- # bangalore-clj (5)
- # beginners (35)
- # boot (79)
- # cider (6)
- # cljs-dev (34)
- # cljsrn (9)
- # clojure (164)
- # clojure-argentina (2)
- # clojure-austin (4)
- # clojure-italy (7)
- # clojure-russia (40)
- # clojure-serbia (1)
- # clojure-spec (76)
- # clojure-uk (36)
- # clojurescript (47)
- # cursive (14)
- # datascript (2)
- # datomic (8)
- # dirac (19)
- # emacs (29)
- # heroku (7)
- # hoplon (35)
- # jobs-rus (1)
- # juxt (2)
- # leiningen (1)
- # lumo (23)
- # mount (4)
- # off-topic (22)
- # om (16)
- # onyx (19)
- # parinfer (10)
- # pedestal (47)
- # proton (5)
- # re-frame (88)
- # rum (1)
- # spacemacs (33)
- # sql (29)
- # uncomplicate (1)
- # unrepl (131)
- # untangled (5)
- # yada (12)
i have some cross clj-cljs code, which accesses a mysql db. If i select a date out using cljs (nodejs), it’s two hours off the clj version.
my guess would be you are storing time without a timezone in mysql, and the timezone on you machine is 2 hours off from utc
That’s a good question 🙂 If I query the db via squirrelsql, it matches the clj version, but that doesn’t mean it’s true
Yes, it’s a TIMESTAMP, no timezone info. My machine is actually 1 hour off UTC (eg CET+1, no DST), so the difference puzzles me
Well it’s not totally important for my use-case whether one or the other value is returned, the important part is that they should be equal. So I’m wondering if there’s something different in the way i connect to the db from clj and cljs.
I’m just wondering, if there are any other queries I can throw at the db from both clients, in order to debug
the timestamps are likely the same, but being turned in to date objects with whatever timezone
They’re js/Date and java.util.Date. None of those should have tz info, but they’re still different
grav: Date definitely does not default to utc, it defaults to whatever the system timezone is
if you prn out a Date object, and it shows a utc time, then call .getTime on that Date object, the getTime will be in the timezone of the Date object, not utc
Well, it seems the cljs instance of the date is off. Which puzzles me since it’s the official mysql npm
Ah, needed to supply :timezone “utc”
to my connection map. Apparently SELECT @@system_time_zone;
wasn’t telling the truth