@@ -40,6 +40,8 @@ export const handle = { crumb: 'Audit Log' }
40
40
function camelToSnakeJson ( o : Record < string , unknown > ) : Record < string , unknown > {
41
41
const result : Record < string , unknown > = { }
42
42
43
+ if ( o instanceof Date ) return o
44
+
43
45
for ( const originalKey in o ) {
44
46
if ( ! Object . prototype . hasOwnProperty . call ( o , originalKey ) ) {
45
47
continue
@@ -72,9 +74,15 @@ const Indent = ({ depth }: { depth: number }) => (
72
74
< span className = "inline-block" style = { { width : `${ depth * 4 + 1 } ch` } } />
73
75
)
74
76
75
- const Primitive = ( { value } : { value : null | boolean | number | string } ) => (
77
+ const Primitive = ( { value } : { value : null | boolean | number | string | Date } ) => (
76
78
< span className = "text-[var(--base-blue-600)]" >
77
- { value === null ? 'null' : typeof value === 'string' ? `"${ value } "` : String ( value ) }
79
+ { value === null
80
+ ? 'null'
81
+ : typeof value === 'string'
82
+ ? `"${ value } "`
83
+ : value instanceof Date
84
+ ? `"${ value . toISOString ( ) } "`
85
+ : String ( value ) }
78
86
</ span >
79
87
)
80
88
@@ -88,7 +96,10 @@ const HighlightJSON = memo(({ json, depth = 0 }: { json: JsonValue; depth?: numb
88
96
json === null ||
89
97
typeof json === 'boolean' ||
90
98
typeof json === 'number' ||
91
- typeof json === 'string'
99
+ typeof json === 'string' ||
100
+ // special case. the types don't currently reflect that this is possible.
101
+ // dates have type object so you can't use typeof
102
+ json instanceof Date
92
103
) {
93
104
return < Primitive value = { json } />
94
105
}
0 commit comments