Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Swap

Manav Rathi1a39846d25ba
diff --git a/web/apps/photos/src/components/PhotoList/index.tsx b/web/apps/photos/src/components/PhotoList/index.tsx
index fd30652db2..152df2e306 100644
--- a/web/apps/photos/src/components/PhotoList/index.tsx
+++ b/web/apps/photos/src/components/PhotoList/index.tsx
@@ -1,4 +1,5 @@
import { assertionFailed } from "@/base/assert";
+import { formattedDate } from "@/base/i18n-date";
import { EnteFile } from "@/media/file";
import {
GAP_BTW_TILES,
@@ -7,7 +8,6 @@ import {
MIN_COLUMNS,
} from "@/new/photos/components/PhotoList";
import { FlexWrapper } from "@ente/shared/components/Container";
-import { formatDate } from "@ente/shared/time/format";
import { Box, Checkbox, Link, Typography, styled } from "@mui/material";
import type { PhotoFrameProps } from "components/PhotoFrame";
import { t } from "i18next";
@@ -946,19 +946,15 @@ const getDate = (item: EnteFile) => {
};
const _getDate = (currentDate: number) => {
- const date = isSameDay(new Date(currentDate), new Date())
+ const date = new Date(currentDate);
+ return isSameDay(date, new Date())
? t("TODAY")
- : isSameDay(new Date(currentDate), new Date(Date.now() - A_DAY))
+ : isSameDay(date, new Date(Date.now() - A_DAY))
? t("YESTERDAY")
- : formatDate(currentDate);
-
- return date;
+ : formattedDate(date);
};
-const isSameDay = (first: Date, second: Date) => {
- return (
- first.getFullYear() === second.getFullYear() &&
- first.getMonth() === second.getMonth() &&
- first.getDate() === second.getDate()
- );
-};
+const isSameDay = (first: Date, second: Date) =>
+ first.getFullYear() === second.getFullYear() &&
+ first.getMonth() === second.getMonth() &&
+ first.getDate() === second.getDate();
diff --git a/web/packages/shared/time/format.ts b/web/packages/shared/time/format.ts
index bce4644699..46589ba4ab 100644
--- a/web/packages/shared/time/format.ts
+++ b/web/packages/shared/time/format.ts
@@ -40,6 +40,6 @@ function formatTime(date: number | Date) {
// return [formatDateFull(dateTime), t("at"), formatTime(dateTime)].join(" ");
// }
-export function formatDateTime(dateTime: number | Date): string {
+function formatDateTime(dateTime: number | Date): string {
return [formatDate(dateTime), t("at"), formatTime(dateTime)].join(" ");
}