Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix

Manav Rathic69fe2a97972
diff --git a/web/apps/photos/src/components/PhotoList/index.tsx b/web/apps/photos/src/components/PhotoList/index.tsx
index 5ac6b263ed..bfc06d8c78 100644
--- a/web/apps/photos/src/components/PhotoList/index.tsx
+++ b/web/apps/photos/src/components/PhotoList/index.tsx
@@ -1,5 +1,5 @@
import { FlexWrapper } from "@ente/shared/components/Container";
-import { formatDate, getDate, isSameDay } from "@ente/shared/time/format";
+import { formatDate } from "@ente/shared/time/format";
import { Box, Checkbox, Link, Typography, styled } from "@mui/material";
import {
DATE_CONTAINER_HEIGHT,
@@ -26,7 +26,6 @@ import { handleSelectCreator } from "utils/photoFrame";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
import { formattedByteSize } from "utils/units";
-const A_DAY = 24 * 60 * 60 * 1000;
const FOOTER_HEIGHT = 90;
const ALBUM_FOOTER_HEIGHT = 75;
const ALBUM_FOOTER_HEIGHT_WITH_REFERRAL = 113;
@@ -887,3 +886,24 @@ export function PhotoList({
</List>
);
}
+
+const A_DAY = 24 * 60 * 60 * 1000;
+
+const getDate = (item: EnteFile) => {
+ const currentDate = item.metadata.creationTime / 1000;
+ const date = isSameDay(new Date(currentDate), new Date())
+ ? t("TODAY")
+ : isSameDay(new Date(currentDate), new Date(Date.now() - A_DAY))
+ ? t("YESTERDAY")
+ : formatDate(currentDate);
+
+ return date;
+};
+
+const isSameDay = (first: Date, second: Date) => {
+ return (
+ 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 0380d56ff6..0e2dc68b52 100644
--- a/web/packages/shared/time/format.ts
+++ b/web/packages/shared/time/format.ts
@@ -1,7 +1,5 @@
import i18n, { t } from "i18next";
-const A_DAY = 24 * 60 * 60 * 1000;
-
const dateTimeFullFormatter1 = new Intl.DateTimeFormat(i18n.language, {
weekday: "short",
month: "short",
@@ -78,22 +76,3 @@ export function formatDateRelative(date: number) {
u as Intl.RelativeTimeFormatUnit,
);
}
-
-export const isSameDay = (first, second) => {
- return (
- first.getFullYear() === second.getFullYear() &&
- first.getMonth() === second.getMonth() &&
- first.getDate() === second.getDate()
- );
-};
-
-export const getDate = (item) => {
- const currentDate = item.metadata.creationTime / 1000;
- const date = isSameDay(new Date(currentDate), new Date())
- ? t("TODAY")
- : isSameDay(new Date(currentDate), new Date(Date.now() - A_DAY))
- ? t("YESTERDAY")
- : formatDate(currentDate);
-
- return date;
-};