Skip to content

armgit / ente

Public Imported from GitHub
0

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

Weekday

Manav Rathida5da33dc256
diff --git a/web/apps/photos/src/worker/search.worker.ts b/web/apps/photos/src/worker/search.worker.ts
index 73605432f6..41cc61d636 100644
--- a/web/apps/photos/src/worker/search.worker.ts
+++ b/web/apps/photos/src/worker/search.worker.ts
@@ -68,7 +68,7 @@ function isSearchedFile(file: EnteFile, search: Search) {
}
const isDateComponentsMatch = (
- { year, month, day }: SearchDateComponents,
+ { year, month, day, weekday }: SearchDateComponents,
date: Date,
) => {
// Components are guaranteed to have at least one component, so start by
@@ -79,6 +79,7 @@ const isDateComponentsMatch = (
// JS getMonth is 0-indexed.
if (match && month) match = date.getMonth() + 1 == month;
if (match && day) match = date.getDate() == day;
+ if (match && weekday) match = date.getDay() == weekday;
return match;
};
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.ts
index 602546415a..4a2309e6bd 100644
--- a/web/packages/new/photos/services/search/index.ts
+++ b/web/packages/new/photos/services/search/index.ts
@@ -28,13 +28,16 @@ export const parseDateComponents = (
const year = component("year");
const month = component("month");
const day = component("day");
+ const weekday = component("weekday");
+ const components = { year, month, day, weekday };
const format: Intl.DateTimeFormatOptions = {};
if (year) format.year = "numeric";
if (month) format.month = "long";
if (day) format.day = "numeric";
+ if (weekday) format.weekday = "long";
const formatter = new Intl.DateTimeFormat(undefined, format);
const formattedDate = formatter.format(p.date());
- return { components: { year, month, day }, formattedDate };
+ return { components, formattedDate };
});
diff --git a/web/packages/new/photos/services/search/types.ts b/web/packages/new/photos/services/search/types.ts
index c009e546c6..a33c7ac21e 100644
--- a/web/packages/new/photos/services/search/types.ts
+++ b/web/packages/new/photos/services/search/types.ts
@@ -25,6 +25,11 @@ export interface SearchDateComponents {
* The day of the month (1 to 31), if the search string specified one.
*/
day?: number;
+ /**
+ * The day of the week (0 to 6, with Sunday being 0), if the search string
+ * specified one.
+ */
+ weekday?: number;
}
/**