From b446c9a407ef299f742efe50d72531a2fea5c480 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Tue, 11 Feb 2025 09:56:23 -0600 Subject: [PATCH 01/10] documentation > api > decelopment.md: address seed data command typo --- documentation/api/development.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/api/development.md b/documentation/api/development.md index 805a4fdfd..c926dc1a3 100644 --- a/documentation/api/development.md +++ b/documentation/api/development.md @@ -14,7 +14,7 @@ This section covers development using Docker. There are a number of Docker comma ### Setup -Run `make init && make run logs` to start the local containers. The application will be available at `http://localhost:8080` and API documentation at `http://localhost:8080/docs`. +Run `make init && make run-logs` to start the local containers. The application will be available at `http://localhost:8080` and API documentation at `http://localhost:8080/docs`. This stands up the following services: @@ -27,7 +27,7 @@ This stands up the following services: ### Seed data -Run `make db-seed-local && populate-search-opportunities` to create local data in the database and make it available in the API. +Run `make db-seed-local && make populate-search-opportunities` to create local data in the database and make it available in the API. ### API Authenticaion From 46f85f51d1f1e95e7d459ce05ae7142e7ed3499f Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Thu, 13 Feb 2025 15:59:23 -0600 Subject: [PATCH 02/10] dateUtils: update formatDate to use dayjs --- frontend/src/utils/dateUtil.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index c0fa7afca..9298bfc78 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -7,28 +7,12 @@ dayjs.extend(advancedFormat); // Convert "2024-02-21" to "February 21, 2024" export function formatDate(dateStr: string | null): string { - if (!dateStr || dateStr.length !== 10) { + if (!dateStr || !dayjs(dateStr).isValid()) { console.warn("invalid date string provided for parse"); return ""; } - const parts = dateStr.split("-"); - - if (parts.length !== 3) { - console.warn("invalid date string provided for parse"); - return ""; - } - - const [year, month, day] = parts.map(Number); - // Create a new Date object using the local time - const date = new Date(year, month - 1, day); - - const options: Intl.DateTimeFormatOptions = { - year: "numeric", - month: "long", - day: "numeric", - }; - return date.toLocaleDateString("en-US", options); + return dayjs(dateStr).format('LL'); } export const getConfiguredDayJs = () => dayjs; From 95bc7adff03d869629d279a6f4928b0dda549c9e Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 12:48:11 -0600 Subject: [PATCH 03/10] run prettier --- frontend/src/utils/dateUtil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index 9298bfc78..38571749e 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -12,7 +12,7 @@ export function formatDate(dateStr: string | null): string { return ""; } - return dayjs(dateStr).format('LL'); + return dayjs(dateStr).format("LL"); } export const getConfiguredDayJs = () => dayjs; From 66be999cdc88f8231999ca4d04d2c59c260159d5 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 12:54:16 -0600 Subject: [PATCH 04/10] specify node version in README development instructions --- frontend/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/README.md b/frontend/README.md index 06ac68978..233677261 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -30,6 +30,7 @@ ### Running the app locally +For version 0.1.0, please install and use node <= v22.13.0. From the `/frontend` directory: 1. Install dependencies From f7fedf476c26064102ca7d71d83b5cfd62c41fb2 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:01:07 -0600 Subject: [PATCH 05/10] dateUtils: add localizedformat --- frontend/src/utils/dateUtil.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index 38571749e..990de638e 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -1,9 +1,11 @@ import dayjs from "dayjs"; import advancedFormat from "dayjs/plugin/advancedFormat"; +import localizedFormat from "dayjs/plugin/localizedFormat"; import timezone from "dayjs/plugin/timezone"; -dayjs.extend(timezone); dayjs.extend(advancedFormat); +dayjs.extend(localizedFormat); +dayjs.extend(timezone); // Convert "2024-02-21" to "February 21, 2024" export function formatDate(dateStr: string | null): string { From 5c72ef61070d259f8dba444d5fb66c6d29fc81e8 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:09:12 -0600 Subject: [PATCH 06/10] dateUtil: update test --- frontend/tests/utils/dateUtil.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/tests/utils/dateUtil.test.ts b/frontend/tests/utils/dateUtil.test.ts index 8529eb04c..468668db4 100644 --- a/frontend/tests/utils/dateUtil.test.ts +++ b/frontend/tests/utils/dateUtil.test.ts @@ -5,11 +5,11 @@ describe("formatDate", () => { beforeEach(() => { jest.spyOn(console, "warn").mockImplementation(identity); }); - it("returns empty string when an incorrectly formatted string is passed", () => { + it("returns empty string when an invalid date string is passed", () => { expect(formatDate(null)).toEqual(""); expect(formatDate("")).toEqual(""); expect(formatDate("Wednesday")).toEqual(""); - expect(formatDate("20241010")).toEqual(""); + expect(formatDate("202441010")).toEqual(""); expect(formatDate(Date.now().toString())).toEqual(""); expect(formatDate("24-10-10")).toEqual(""); }); From ab0541512bd3ca94e99d6f7963a975f7a92bbb11 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:17:13 -0600 Subject: [PATCH 07/10] dateUtil: update test --- frontend/tests/utils/dateUtil.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/tests/utils/dateUtil.test.ts b/frontend/tests/utils/dateUtil.test.ts index 468668db4..5834884cb 100644 --- a/frontend/tests/utils/dateUtil.test.ts +++ b/frontend/tests/utils/dateUtil.test.ts @@ -9,13 +9,14 @@ describe("formatDate", () => { expect(formatDate(null)).toEqual(""); expect(formatDate("")).toEqual(""); expect(formatDate("Wednesday")).toEqual(""); - expect(formatDate("202441010")).toEqual(""); + expect(formatDate("20")).toEqual(""); expect(formatDate(Date.now().toString())).toEqual(""); expect(formatDate("24-10-10")).toEqual(""); }); it("returns a human readable string for properly formatted dates", () => { expect(formatDate("2024-10-10")).toBe("October 10, 2024"); + expect(formatDate("20241010")).toBe("October 10, 2024"); }); it("invokes console warn when date string does not contain 3 parts", () => { From d26ac762dddd119f1c7e0f2b45d2b9ca988b1d0b Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:21:13 -0600 Subject: [PATCH 08/10] dateUtil: update test --- frontend/tests/utils/dateUtil.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/tests/utils/dateUtil.test.ts b/frontend/tests/utils/dateUtil.test.ts index 5834884cb..9015e0831 100644 --- a/frontend/tests/utils/dateUtil.test.ts +++ b/frontend/tests/utils/dateUtil.test.ts @@ -10,13 +10,13 @@ describe("formatDate", () => { expect(formatDate("")).toEqual(""); expect(formatDate("Wednesday")).toEqual(""); expect(formatDate("20")).toEqual(""); - expect(formatDate(Date.now().toString())).toEqual(""); expect(formatDate("24-10-10")).toEqual(""); }); it("returns a human readable string for properly formatted dates", () => { expect(formatDate("2024-10-10")).toBe("October 10, 2024"); expect(formatDate("20241010")).toBe("October 10, 2024"); + expect(formatDate(Date.now().toString())).toEqual(""); }); it("invokes console warn when date string does not contain 3 parts", () => { From 8e836004dd56eeca25ea9f67a41794dfb28380c4 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:29:18 -0600 Subject: [PATCH 09/10] dateUtil: update test --- frontend/src/utils/dateUtil.ts | 4 +++- frontend/tests/utils/dateUtil.test.ts | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index 990de638e..954724c19 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -1,15 +1,17 @@ import dayjs from "dayjs"; import advancedFormat from "dayjs/plugin/advancedFormat"; +import customParseFormat from "dayjs/plugin/customParseFormat"; import localizedFormat from "dayjs/plugin/localizedFormat"; import timezone from "dayjs/plugin/timezone"; dayjs.extend(advancedFormat); +dayjs.extend(customParseFormat); dayjs.extend(localizedFormat); dayjs.extend(timezone); // Convert "2024-02-21" to "February 21, 2024" export function formatDate(dateStr: string | null): string { - if (!dateStr || !dayjs(dateStr).isValid()) { + if (!dateStr || !dayjs(dateStr, 'YYYY-MM-DD', true).isValid()) { console.warn("invalid date string provided for parse"); return ""; } diff --git a/frontend/tests/utils/dateUtil.test.ts b/frontend/tests/utils/dateUtil.test.ts index 9015e0831..d1a74e062 100644 --- a/frontend/tests/utils/dateUtil.test.ts +++ b/frontend/tests/utils/dateUtil.test.ts @@ -9,14 +9,13 @@ describe("formatDate", () => { expect(formatDate(null)).toEqual(""); expect(formatDate("")).toEqual(""); expect(formatDate("Wednesday")).toEqual(""); - expect(formatDate("20")).toEqual(""); + expect(formatDate("20241010")).toBe(""); expect(formatDate("24-10-10")).toEqual(""); + expect(formatDate(Date.now().toString())).toEqual(""); }); - + it("returns a human readable string for properly formatted dates", () => { expect(formatDate("2024-10-10")).toBe("October 10, 2024"); - expect(formatDate("20241010")).toBe("October 10, 2024"); - expect(formatDate(Date.now().toString())).toEqual(""); }); it("invokes console warn when date string does not contain 3 parts", () => { From 9da02eaf88146e6cf3f7003927fade09bf34d964 Mon Sep 17 00:00:00 2001 From: karinamzalez Date: Fri, 14 Feb 2025 13:32:31 -0600 Subject: [PATCH 10/10] run prettier --- frontend/src/utils/dateUtil.ts | 2 +- frontend/tests/utils/dateUtil.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index 954724c19..ef672b8eb 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -11,7 +11,7 @@ dayjs.extend(timezone); // Convert "2024-02-21" to "February 21, 2024" export function formatDate(dateStr: string | null): string { - if (!dateStr || !dayjs(dateStr, 'YYYY-MM-DD', true).isValid()) { + if (!dateStr || !dayjs(dateStr, "YYYY-MM-DD", true).isValid()) { console.warn("invalid date string provided for parse"); return ""; } diff --git a/frontend/tests/utils/dateUtil.test.ts b/frontend/tests/utils/dateUtil.test.ts index d1a74e062..5844cb1dd 100644 --- a/frontend/tests/utils/dateUtil.test.ts +++ b/frontend/tests/utils/dateUtil.test.ts @@ -13,7 +13,7 @@ describe("formatDate", () => { expect(formatDate("24-10-10")).toEqual(""); expect(formatDate(Date.now().toString())).toEqual(""); }); - + it("returns a human readable string for properly formatted dates", () => { expect(formatDate("2024-10-10")).toBe("October 10, 2024"); });