@@ -40,6 +40,8 @@ export const handle = { crumb: 'Audit Log' }
4040function camelToSnakeJson ( o : Record < string , unknown > ) : Record < string , unknown > {
4141 const result : Record < string , unknown > = { }
4242
43+ if ( o instanceof Date ) return o
44+
4345 for ( const originalKey in o ) {
4446 if ( ! Object . prototype . hasOwnProperty . call ( o , originalKey ) ) {
4547 continue
@@ -72,9 +74,15 @@ const Indent = ({ depth }: { depth: number }) => (
7274 < span className = "inline-block" style = { { width : `${ depth * 4 + 1 } ch` } } />
7375)
7476
75- const Primitive = ( { value } : { value : null | boolean | number | string } ) => (
77+ const Primitive = ( { value } : { value : null | boolean | number | string | Date } ) => (
7678 < 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 ) }
7886 </ span >
7987)
8088
@@ -88,7 +96,10 @@ const HighlightJSON = memo(({ json, depth = 0 }: { json: JsonValue; depth?: numb
8896 json === null ||
8997 typeof json === 'boolean' ||
9098 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
92103 ) {
93104 return < Primitive value = { json } />
94105 }
0 commit comments