@@ -27,11 +27,7 @@ export const NumberParam: QueryParamConfig<
2727 * For flat objects where values are strings
2828 */
2929export const ObjectParam : QueryParamConfig <
30- | {
31- [ key : string ] : string | undefined ;
32- }
33- | null
34- | undefined ,
30+ { [ key : string ] : string | undefined } | null | undefined ,
3531 { [ key : string ] : string | undefined } | null | undefined
3632> = {
3733 encode : Serialize . encodeObject ,
@@ -77,6 +73,20 @@ export const DateParam: QueryParamConfig<
7773> = {
7874 encode : Serialize . encodeDate ,
7975 decode : Serialize . decodeDate ,
76+ equals : (
77+ valueA : Date | null | undefined ,
78+ valueB : Date | null | undefined
79+ ) => {
80+ if ( valueA === valueB ) return true ;
81+ if ( valueA == null || valueB == null ) return valueA === valueB ;
82+
83+ // ignore time of day
84+ return (
85+ valueA . getFullYear ( ) === valueB . getFullYear ( ) &&
86+ valueA . getMonth ( ) === valueB . getMonth ( ) &&
87+ valueA . getDate ( ) === valueB . getDate ( )
88+ ) ;
89+ } ,
8090} ;
8191
8292/**
@@ -88,6 +98,15 @@ export const DateTimeParam: QueryParamConfig<
8898> = {
8999 encode : Serialize . encodeDateTime ,
90100 decode : Serialize . decodeDateTime ,
101+ equals : (
102+ valueA : Date | null | undefined ,
103+ valueB : Date | null | undefined
104+ ) => {
105+ if ( valueA === valueB ) return true ;
106+ if ( valueA == null || valueB == null ) return valueA === valueB ;
107+
108+ return valueA . valueOf ( ) === valueB . valueOf ( ) ;
109+ } ,
91110} ;
92111
93112/**
@@ -105,11 +124,7 @@ export const BooleanParam: QueryParamConfig<
105124 * For flat objects where the values are numbers
106125 */
107126export const NumericObjectParam : QueryParamConfig <
108- | {
109- [ key : string ] : number | null | undefined ;
110- }
111- | null
112- | undefined ,
127+ { [ key : string ] : number | null | undefined } | null | undefined ,
113128 { [ key : string ] : number | null | undefined } | null | undefined
114129> = {
115130 encode : Serialize . encodeNumericObject ,
0 commit comments