Code Monkey home page Code Monkey logo

Comments (5)

dm3 avatar dm3 commented on May 29, 2024

do I understand correctly that you have data with org.joda.time.Instant/org.joda.time.DateTime fields inside which you want to serialize into ISO8601 strings?

Haven't actually noticed Inst before. Your solution would definitely work. It has an additional benefit of not transforming the datastructure just to change the type of instants. Also, there shouldn't be any problems with globally extending Inst for DateTime as in Joda-Time it is analogous to an Instant.

I don't think there's anything in this project that can help you do what you want to do in a more direct way.

from clojure.java-time.

lvh avatar lvh commented on May 29, 2024

Yeah, my problem is fully solved by this piece of code, but perhaps it'd be good to add this to the portability code here so it automatically works for everyone :)

It might make more sense in clj-time instead?

from clojure.java-time.

dm3 avatar dm3 commented on May 29, 2024

Hmm, I think adding

(extend-type org.joda.time.ReadableInstant
     Inst (inst-ms* [inst] (.getMillis inst)))

shouldn't break anything. However, a library shouldn't be extending foreign types with foreign protocols. This may have a place in an explicitly invoked method or documentation though.

from clojure.java-time.

dm3 avatar dm3 commented on May 29, 2024

Added a when-joda-time-loaded macro to the public API. Updated docs.

from clojure.java-time.

lvh avatar lvh commented on May 29, 2024

Cool, thanks :) I look forward to using this feature in a new release.

from clojure.java-time.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.