Skip to content

Instantly share code, notes, and snippets.

@maacl
Created December 7, 2022 23:53
Show Gist options
  • Save maacl/8815f187410e87e3515e1d44139afe38 to your computer and use it in GitHub Desktop.
Save maacl/8815f187410e87e3515e1d44139afe38 to your computer and use it in GitHub Desktop.
Date fun
shadow.user> (->
(t/local-date 2004 2 29)
(t/plus (t/years 1) (t/days 1)))
;; => #object[java.time.LocalDate 0x75a742c8 "2005-03-01"]
shadow.user> (->
(t/local-date 2004 2 28)
(t/plus (t/years 1) (t/days 1)))
;; => #object[java.time.LocalDate 0x12132de3 "2005-03-01"]
shadow.user> (->
(t/local-date 2004 2 29)
(t/plus (t/days 1) (t/years 1)))
;; => #object[java.time.LocalDate 0x440f79f "2005-03-01"]
shadow.user> (->
(t/local-date 2004 2 28)
(t/plus (t/days 1) (t/years 1)))
;; => #object[java.time.LocalDate 0x597035d6 "2005-02-28"]
@mjul
Copy link

mjul commented Dec 14, 2022

Great example! The semantics are strange, but it does follow the documented behaviour for LocalDate plusYears

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment