fix currentDate set as -1 matched with files on date 1 jan 1970 +- 1

This commit is contained in:
Abhinav 2023-01-02 18:15:47 +05:30
parent 2138a34f69
commit 553c8f78f8

View file

@ -310,10 +310,10 @@ export function PhotoList({
const groupByTime = (timeStampList: TimeStampListItem[]) => {
let listItemIndex = 0;
let currentDate = -1;
let currentDate;
filteredData.forEach((item, index) => {
if (
!currentDate ||
!isSameDay(
new Date(item.metadata.creationTime / 1000),
new Date(currentDate)
@ -353,10 +353,20 @@ export function PhotoList({
});
};
const isSameDay = (first, second) =>
const isSameDay = (first, second) => {
console.log(
first,
second,
first.getFullYear() === second.getFullYear(),
first.getMonth() === second.getMonth(),
first.getDate() === second.getDate()
);
return (
first.getFullYear() === second.getFullYear() &&
first.getMonth() === second.getMonth() &&
first.getDate() === second.getDate();
first.getDate() === second.getDate()
);
};
const getPhotoListHeader = (photoListHeader) => {
return {