This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-12
Channels
- # bangalore-clj (1)
- # beginners (10)
- # boot (5)
- # cljs-dev (47)
- # cljsrn (19)
- # clojure (57)
- # clojure-russia (63)
- # clojure-spec (26)
- # clojure-uk (7)
- # clojurescript (104)
- # cursive (26)
- # data-science (2)
- # datomic (1)
- # dirac (1)
- # hoplon (11)
- # juxt (23)
- # off-topic (16)
- # om (6)
- # onyx (3)
- # parinfer (2)
- # protorepl (2)
- # re-frame (1)
- # ring-swagger (1)
- # untangled (2)
@imre you can convert between java.util.Date and java.time.Instant with .toInstant - doesn't that help?
My problem is with cases when I want to store data that is not an instant, for example a LocalDate, YearMonth or LocalTime etc.
Usually when I talk about dates, I use LocalDate - that has just the right amount and precision I need, making compatison semantics unambiguous
In my opinion, when you are working with dates and persistence, you should work with instants plus a separate field for persist the timezone if it is needed. Later, when you should perform operations or just present that to the user, convert that instant to zoned date...
In almost all operations that you are going to do with dates, the correct way is doing them with instant, the timezone information is just a presentation property
doing operations with zoned date can cause unexpected situations and strange errors...
thanks for the insight @niwinz - are you aware of any resources where I could find more info about these problems you are referring to?
Date seems to be a decent representation of Instants but I found that when talking about dates (without the time part) it has too much info
As for zoned datetimes - in case the tz the information was recorded in is not important, Instant is perfect
but when TZ is important I like to keep it bundled otherwise it can get lost or ignored/forgotten to be taken into account