|
6 | 6 | [puget.printer :as puget] |
7 | 7 | [arrangement.core] |
8 | 8 | [lambdaisland.deep-diff.diff :as diff]) |
9 | | - (:import (java.text SimpleDateFormat) |
10 | | - (java.util TimeZone) |
11 | | - (java.sql Timestamp))) |
| 9 | + #?(:clj (:import (java.text SimpleDateFormat) |
| 10 | + (java.util TimeZone) |
| 11 | + (java.sql Timestamp))) |
| 12 | + ) |
12 | 13 |
|
13 | 14 | (defn print-deletion [printer expr] |
14 | 15 | (let [no-color (assoc printer :print-color false)] |
|
40 | 41 | (def ^:private ^ThreadLocal thread-local-utc-date-format |
41 | 42 | (proxy [ThreadLocal] [] |
42 | 43 | (initialValue [] |
43 | | - (doto (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00") |
44 | | - (.setTimeZone (TimeZone/getTimeZone "GMT")))))) |
| 44 | + #?(:clj (doto (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00") |
| 45 | + (.setTimeZone (TimeZone/getTimeZone "GMT"))) |
| 46 | + :cljs (doto (cljs-time.format/formatter "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00")))))) |
45 | 47 |
|
46 | 48 | (def ^:private print-date |
47 | 49 | (puget/tagged-handler |
48 | | - 'inst |
49 | | - #(.format ^SimpleDateFormat (.get thread-local-utc-date-format) %))) |
| 50 | + 'inst |
| 51 | + #(.format ^SimpleDateFormat (.get thread-local-utc-date-format) %))) |
50 | 52 |
|
51 | 53 | (def ^:private ^ThreadLocal thread-local-utc-timestamp-format |
52 | 54 | (proxy [ThreadLocal] [] |
|
56 | 58 |
|
57 | 59 | (def ^:private print-timestamp |
58 | 60 | (puget/tagged-handler |
59 | | - 'inst |
60 | | - #(str (.format ^SimpleDateFormat (.get thread-local-utc-timestamp-format) %) |
61 | | - (format ".%09d-00:00" (.getNanos ^Timestamp %))))) |
| 61 | + 'inst |
| 62 | + #(str (.format ^SimpleDateFormat (.get thread-local-utc-timestamp-format) %) |
| 63 | + (format ".%09d-00:00" (.getNanos ^Timestamp %))))) |
62 | 64 |
|
63 | 65 | (def ^:private print-calendar |
64 | 66 | (puget/tagged-handler |
65 | | - 'inst |
66 | | - #(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %) |
67 | | - offset-minutes (- (.length formatted) 2)] |
68 | | - (str (subs formatted 0 offset-minutes) |
69 | | - ":" |
70 | | - (subs formatted offset-minutes))))) |
| 67 | + 'inst |
| 68 | + #(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %) |
| 69 | + offset-minutes (- (.length formatted) 2)] |
| 70 | + (str (subs formatted 0 offset-minutes) |
| 71 | + ":" |
| 72 | + (subs formatted offset-minutes))))) |
71 | 73 |
|
72 | 74 | (def ^:private print-handlers |
73 | 75 | {'lambdaisland.deep_diff.diff.Deletion |
|
0 commit comments