java.util.Calendar + java.time round-trip + java.sql.Date class
java.util.Calendar (a UTC calendar over epoch-ms): getInstance, the int field constants, set/get/setTime/getTime/getTimeInMillis. java.time pieces for a zoned round-trip: DateTimeFormatter/ISO_ZONED_DATE_TIME, formatter .withZone/.parse, LocalDateTime/parse (with formatter), Instant/from, .toLocalDate/.atStartOfDay. java.sql.Date is now a distinct class (its own host value + dispatch tags) so a protocol extended to both java.util.Date and java.sql.Date routes a sql.Date to its own impl. All UTC-consistent. data.json print-sql-date + print-time-supports-format pass (suite 137/139).
This commit is contained in:
parent
7e10904e8c
commit
9092b30f8b
2 changed files with 92 additions and 13 deletions
|
|
@ -141,6 +141,9 @@
|
|||
((jinst? obj) '("Date" "java.util.Date" "Timestamp" "java.sql.Timestamp" "Object"))
|
||||
((jbigdec? obj) '("BigDecimal" "java.math.BigDecimal" "Number" "Object"))
|
||||
((and (jhost? obj) (string=? (jhost-tag obj) "instant")) '("Instant" "java.time.Instant" "Object"))
|
||||
;; java.sql.Date — a distinct class from java.util.Date so a protocol
|
||||
;; extended to both (data.json's JSONWriter) routes a sql.Date to its impl.
|
||||
((and (jhost? obj) (string=? (jhost-tag obj) "sql-date")) '("java.sql.Date" "Date" "java.util.Date" "Object"))
|
||||
;; a bare procedure (fn) — extend-protocol to clojure.lang.{Fn,IFn,AFn}.
|
||||
((procedure? obj) '("Fn" "IFn" "AFn" "Object"))
|
||||
((jolt-nil? obj) '("nil"))
|
||||
|
|
@ -192,7 +195,7 @@
|
|||
"ASeq" "ISeq" "IPersistentCollection" "Associative" "Sequential"
|
||||
"Map" "java.util.Map" "List" "java.util.List" "Set" "java.util.Set"
|
||||
"Collection" "java.util.Collection"
|
||||
"UUID" "BigDecimal" "Date" "Timestamp" "Instant"))
|
||||
"UUID" "BigDecimal" "Date" "Timestamp" "Instant" "java.sql.Date"))
|
||||
h))
|
||||
(define (strip-prefix s p)
|
||||
(let ((pl (string-length p)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue