@@ -233,7 +233,9 @@ function compareObjects(self: object, that: object): boolean {
233233 return false
234234 } else if ( self instanceof Date ) {
235235 if ( ! ( that instanceof Date ) ) return false
236- return self . toISOString ( ) === that . toISOString ( )
236+ const selfTime = self . getTime ( )
237+ const thatTime = that . getTime ( )
238+ return selfTime === thatTime || ( Number . isNaN ( selfTime ) && Number . isNaN ( thatTime ) )
237239 } else if ( self instanceof RegExp ) {
238240 if ( ! ( that instanceof RegExp ) ) return false
239241 return self . toString ( ) === that . toString ( )
@@ -254,9 +256,21 @@ function compareObjects(self: object, that: object): boolean {
254256 }
255257 return compareArrays ( self , that )
256258 } else if ( ArrayBuffer . isView ( self ) ) {
257- if ( ! ArrayBuffer . isView ( that ) || self . byteLength !== that . byteLength ) {
259+ const selfIsDataView = self instanceof DataView
260+ if (
261+ ! ArrayBuffer . isView ( that ) ||
262+ self . byteLength !== that . byteLength ||
263+ selfIsDataView !== ( that instanceof DataView )
264+ ) {
258265 return false
259266 }
267+ if ( selfIsDataView ) {
268+ const thatDataView = that as DataView
269+ return compareTypedArrays (
270+ new Uint8Array ( self . buffer , self . byteOffset , self . byteLength ) ,
271+ new Uint8Array ( thatDataView . buffer , thatDataView . byteOffset , thatDataView . byteLength )
272+ )
273+ }
260274 return compareTypedArrays ( self as Uint8Array , that as Uint8Array )
261275 } else if ( self instanceof Map ) {
262276 if ( ! ( that instanceof Map ) || self . size !== that . size ) {
0 commit comments