Compare files based on LastWriteTime if basename matches

I have two sets of files, one folder contains one filetype and another folder contains the other filetype.


Folder 1 has .filetype1
Folder 2 has .filetype2

Every file in folder1 has a matching partner in folder2. The common thing is .basename. To get files where basename matches i'm just doing:

$dir1 | where {$_.BaseName -in $dir2.BaseName}


this however is not possible to do when comparing .LastWriteTime as that function will match $_.LastWriteTime to any file in $dir2.LastWriteTime


If $_.Basename -eq $dir2.basename find files where .LastWriteTime differs  <-- help is wanted