Fix get time on non date var (#14361)

This commit is contained in:
Paul Rastoin
2025-09-09 09:59:55 +02:00
committed by GitHub
parent f7cde28dd6
commit 7bcbaee0c8
3 changed files with 13 additions and 2 deletions
@@ -1,3 +1,5 @@
import { transpileToDateIfNot } from 'src/utils/transpile-to-date-if-not.util';
export const filterMorphRelationDuplicateFields = <
T extends { createdAt: Date; morphId: string | null },
>(
@@ -7,7 +9,8 @@ export const filterMorphRelationDuplicateFields = <
return !fields.some(
(otherField) =>
otherField.morphId === currentField.morphId &&
otherField.createdAt.getTime() > currentField.createdAt.getTime(),
transpileToDateIfNot(otherField.createdAt).getTime() >
transpileToDateIfNot(currentField.createdAt).getTime(),
);
});
};