Skip to content
Snippets Groups Projects
Commit 5b201cc2 authored by Cam Saül's avatar Cam Saül
Browse files

Merge pull request #230 from metabase/serialize_dates_as_dates

serialize `java.sql.Date` as YYYY-MM-DD instead as a timestamp
parents 14f4e9a5 6b26dd68
No related branches found
No related tags found
No related merge requests found
......@@ -14,9 +14,16 @@
;; ## Custom JSON encoders
(add-encoder org.h2.jdbc.JdbcClob (fn [clob ^com.fasterxml.jackson.core.JsonGenerator json-generator] ; stringify JDBC Clobs
;; stringify JDBC clobs
(add-encoder org.h2.jdbc.JdbcClob (fn [clob ^com.fasterxml.jackson.core.JsonGenerator json-generator]
(.writeString json-generator (util/jdbc-clob->str clob))))
(add-encoder org.postgresql.util.PGobject encode-str) ; stringify Postgres binary objects (e.g. PostGIS geometries)
;; stringify Postgres binary objects (e.g. PostGIS geometries)
(add-encoder org.postgresql.util.PGobject encode-str)
;; serialize sql dates (i.e., QueryProcessor results) like YYYY-MM-DD instead of as a full-blown timestamp
(add-encoder java.sql.Date (fn [^java.sql.Date date ^com.fasterxml.jackson.core.JsonGenerator json-generator]
(.writeString json-generator (.toString date))))
;; ## FORMAT RESPONSE MIDDLEWARE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment