diff --git a/package-lock.json b/package-lock.json index 40b42dfa7..0f54013a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -77,7 +77,7 @@ "ts-node": "10.9.2", "typescript": "5.7.2", "typescript-eslint": "8.21.0", - "uglify-js": "*", + "uglify-js": "latest", "webpack": "5.97.1" }, "engines": { diff --git a/src/app/development/middleware.ts b/src/app/development/middleware.ts index 4738e8233..9f1759985 100644 --- a/src/app/development/middleware.ts +++ b/src/app/development/middleware.ts @@ -11,6 +11,7 @@ import { getAppStoreRedirectUrl } from "../shared/appDownloadHelper"; import PAGES from "../../constants/ipv-pages"; import { getIpvPageTemplatePath, getTemplatePath } from "../../lib/paths"; import { pagesAndContexts } from "../../test-utils/pages-and-contexts"; +import config from "../../config/config"; interface RadioOption { text: string; @@ -113,12 +114,8 @@ export const templatesDisplayGet: RequestHandler = async (req, res) => { validatePhoneType(phoneType); renderOptions.appDownloadUrl = getAppStoreRedirectUrl(phoneType); } else if (templateId === PAGES.PAGE_FACE_TO_FACE_HANDOFF) { - let today = new Date(); - if (process.env.NODE_ENV === "local") { - today = new Date("2025-01-01"); - } renderOptions.postOfficeVisitByDate = new Date().setDate( - today.getDate() + 15, + new Date("2025-01-01").getDate() + config.POST_OFFICE_VISIT_BY_DAYS, ); } diff --git a/src/app/ipv/middleware.ts b/src/app/ipv/middleware.ts index ea6dd4e36..d326008b2 100644 --- a/src/app/ipv/middleware.ts +++ b/src/app/ipv/middleware.ts @@ -359,7 +359,7 @@ export const handleJourneyPageRequest = async ( renderOptions.appDownloadUrl = getAppStoreRedirectUrl(context); } else if (pageId === PAGES.PAGE_FACE_TO_FACE_HANDOFF) { renderOptions.postOfficeVisitByDate = new Date().setDate( - new Date().getDate() + 15, + new Date().getDate() + config.POST_OFFICE_VISIT_BY_DAYS, ); } else if (req.session.currentPageStatusCode !== undefined) { // Set this to avoid pino-http generating a new error in the request log diff --git a/src/config/config.ts b/src/config/config.ts index c2214822c..0742aaf0d 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -47,4 +47,5 @@ export default { process.env.DELETE_ACCOUNT_URL ?? "https://home.build.account.gov.uk/enter-password?type=deleteAccount", SSM_PARAMETER_CACHE_TTL: process.env.SSM_PARAMETER_CACHE_TTL ?? "300000", // Cache duration in milliseconds (5 minutes) + POST_OFFICE_VISIT_BY_DAYS: 15, };