Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date object behaves confusingly when printed #15

Open
saitouena opened this issue Nov 25, 2019 · 0 comments
Open

date object behaves confusingly when printed #15

saitouena opened this issue Nov 25, 2019 · 0 comments

Comments

@saitouena
Copy link
Contributor

saitouena commented Nov 25, 2019

My environment:

  • Clojure 1.10.1
  • openjdk version "1.8.0_222" OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10) OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
(def zero-zone (t/time-zone "GMT+00:00"))

(def plus8-zone (t/time-zone "GMT+08:00"))

(t/date d :time-zone zero-zone)
=> #inst"2019-11-25T05:15:28.738-00:00"
(t/date d :time-zone plus8-zone)
=> #inst"2019-11-25T05:15:28.738-00:00"
;; looks same

(-> d
    (t/date :time-zone zero-zone)
    (t/format "yyyyMMdd HH:mm:ss"))
=> "20191125 05:15:28"
(-> d
    (t/date :time-zone plus8-zone)
    (t/format "yyyyMMdd HH:mm:ss"))
=> "20191125 13:15:28"
;; format works correct

I haven't read the codes, but I think wrapping date object and implementing toString can be a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant