deep-diff2 icon indicating copy to clipboard operation
deep-diff2 copied to clipboard

Print java.time.Instant as #inst

Open plexus opened this issue 6 years ago • 5 comments

A follow-up to #10, it would be great to also print the newer java.time.* classes as #inst.

plexus avatar Apr 11 '19 07:04 plexus

thanks for deep-diff!

I don't have time just now but at some point I'd like to have a go getting deep-diff print java.time objs printed using https://github.com/henryw374/time-literals. which would work in cljs as well

henryw374 avatar Jul 03 '20 10:07 henryw374

thanks for deep-diff!

I don't have time just now but at some point I'd like to have a go getting deep-diff print java.time objs printed using https://github.com/henryw374/time-literals. which would work in cljs as well

actually nothing in deep-diff needs to change for this to work, just add time-literals or equivalent to deps so java.time classes read/print time literals.

IOW this is not a responsibility deep-diff should have

henryw374 avatar Jul 20 '20 11:07 henryw374

I don't think that's really true, Puget has its own dispatch logic and type-specific handlers

(we forked puget and inlined it to add cljs support)

https://github.com/lambdaisland/deep-diff2/blob/master/src/lambdaisland/deep_diff2/puget/printer.cljc#L295-L355

plexus avatar Jul 21 '20 09:07 plexus

ah I wasn't using pretty-print, just diff - I see pretty-print doesn't use tagged literals by default.

supplying pretty-print with a printer configured as {:print-fallback :print} does the trick.

It'd be interesting to know why that isn't the default though.

henryw374 avatar Jul 21 '20 11:07 henryw374

I didn't even realize that was a thing. This changes everything. (well maybe not everything but yes that should be the default).

plexus avatar Dec 08 '20 09:12 plexus

After this MR, it seems that this issue is solved, doesn't it?

humorless avatar Mar 10 '23 07:03 humorless