Skip to content

Commit 9e3ae1a

Browse files
committed
Fix sorting file by date bug.
1 parent 750469b commit 9e3ae1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const SortOrder = {
1111
function sortFilesByDate(filesList, sortByDate = SortOrder.ASC) {
1212
const result = filesList.sort((a, b) => {
1313
if (sortByDate === SortOrder.DESC) {
14-
return a.lastModified.getTime() < b.lastModified.getTime();
14+
return b.lastModified.getTime() - a.lastModified.getTime();
1515
}
16-
return a.lastModified.getTime() > b.lastModified.getTime();
16+
return a.lastModified.getTime() - b.lastModified.getTime();
1717
});
1818

1919
return result;

0 commit comments

Comments
 (0)