diff --git a/CHANGELOG.md b/CHANGELOG.md index d1251f81ad..6b54fa521a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v6.159.0](https://github.com/opengovsg/FormSG/compare/v6.158.2...v6.159.0) + +- chore: log email on error [`#7863`](https://github.com/opengovsg/FormSG/pull/7863) +- build: merge release v6.158.2 to develop [`#7864`](https://github.com/opengovsg/FormSG/pull/7864) +- fix: date utc and typing issues [`#7862`](https://github.com/opengovsg/FormSG/pull/7862) +- build: release v6.158.2 [`#7860`](https://github.com/opengovsg/FormSG/pull/7860) +- build: merge release v6.158.1 to develop [`#7852`](https://github.com/opengovsg/FormSG/pull/7852) +- fix: handle string response in DTO for date validation object [`#7850`](https://github.com/opengovsg/FormSG/pull/7850) +- fix: add missed v3 to log [`#7851`](https://github.com/opengovsg/FormSG/pull/7851) +- fix(deps): bump openai from 4.63.0 to 4.70.3 [`#7841`](https://github.com/opengovsg/FormSG/pull/7841) + #### [v6.158.2](https://github.com/opengovsg/FormSG/compare/v6.158.1...v6.158.2) +> 7 November 2024 + +- chore(typing): date [`#7861`](https://github.com/opengovsg/FormSG/pull/7861) +- fix(calendar): incorrect date conversion [`#7859`](https://github.com/opengovsg/FormSG/pull/7859) - fix: use settimeout instead of debounce [`#7856`](https://github.com/opengovsg/FormSG/pull/7856) - fix: add debounce to break infinite call loop (#7848) [`#7849`](https://github.com/opengovsg/FormSG/pull/7849) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 486dc9cfe0..bac55c1167 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "form-frontend", - "version": "6.158.2", + "version": "6.159.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "form-frontend", - "version": "6.158.2", + "version": "6.159.0", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^2.8.2", diff --git a/frontend/package.json b/frontend/package.json index 1b756503d0..fe7e25c0e9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "form-frontend", - "version": "6.158.2", + "version": "6.159.0", "homepage": ".", "type": "module", "private": true, diff --git a/frontend/src/utils/date.ts b/frontend/src/utils/date.ts index 4b8ea55b6b..e81911c323 100644 --- a/frontend/src/utils/date.ts +++ b/frontend/src/utils/date.ts @@ -41,13 +41,18 @@ export const isDateAfterToday = (date: number | Date) => { } export const normalizeDateToUtc = (date: Date | null) => { - if (!date) return date + if (!date) return null return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())) } -export const loadDateFromNormalizedDate = (date: Date | null) => { - if (!date) return date - return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) +export const loadDateFromNormalizedDate = (date: string | Date | null) => { + if (!date) return null + const parsedDate = typeof date === 'string' ? parseISO(date) : date + return new Date( + parsedDate.getUTCFullYear(), + parsedDate.getUTCMonth(), + parsedDate.getUTCDate(), + ) } /** diff --git a/package-lock.json b/package-lock.json index f171aafdd3..d1d109328b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FormSG", - "version": "6.158.2", + "version": "6.159.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "FormSG", - "version": "6.158.2", + "version": "6.159.0", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.536.0", @@ -79,7 +79,7 @@ "nocache": "^3.0.4", "node-cache": "^5.1.2", "nodemailer": "^6.9.13", - "openai": "^4.63.0", + "openai": "^4.70.3", "openid-client": "^5.3.1", "opossum": "^8.1.4", "promise-retry": "^2.0.1", @@ -24540,9 +24540,9 @@ } }, "node_modules/openai": { - "version": "4.63.0", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.63.0.tgz", - "integrity": "sha512-Y9V4KODbmrOpqiOmCDVnPfMxMqKLOx8Hwcdn/r8mePq4yv7FSXGnxCs8/jZKO7zCB/IVPWihpJXwJNAIOEiZ2g==", + "version": "4.70.3", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.70.3.tgz", + "integrity": "sha512-N2XOWjuT5yKIdLgjZkQt9i5+cAXI7qKM7E5PpIsmVfnTi/Y812omr3rozgKwxXJC6aga8nl2BWos4HRdlZllFA==", "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", diff --git a/package.json b/package.json index 3ed294cc38..634ad8178c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "6.158.2", + "version": "6.159.0", "homepage": "https://form.gov.sg", "authors": [ "FormSG " @@ -125,7 +125,7 @@ "nocache": "^3.0.4", "node-cache": "^5.1.2", "nodemailer": "^6.9.13", - "openai": "^4.63.0", + "openai": "^4.70.3", "openid-client": "^5.3.1", "opossum": "^8.1.4", "promise-retry": "^2.0.1", diff --git a/shared/types/field/dateField.ts b/shared/types/field/dateField.ts index da3aa15408..fe17da1339 100644 --- a/shared/types/field/dateField.ts +++ b/shared/types/field/dateField.ts @@ -18,8 +18,9 @@ export enum InvalidDaysOptions { } export type DateValidationOptions = { - customMaxDate: Date | null - customMinDate: Date | null + // NOTE: the customMaxDate and customMinDate becomes a string when fetched as a response from the server. + customMaxDate: Date | string | null + customMinDate: Date | string | null selectedDateValidation: DateSelectedValidation | null } diff --git a/src/app/utils/field-validation/validators/checkboxValidator.ts b/src/app/utils/field-validation/validators/checkboxValidator.ts index 1d519f3dfe..eb8e20ffd1 100644 --- a/src/app/utils/field-validation/validators/checkboxValidator.ts +++ b/src/app/utils/field-validation/validators/checkboxValidator.ts @@ -291,7 +291,7 @@ const makeValidOptionsValidatorV3: ResponseValidatorConstructor< (!answer.value.includes(CLIENT_CHECKBOX_OTHERS_INPUT_VALUE) || othersRadioButton) ? right(response) - : left(`CheckboxValidator:\t answer is not valid`) + : left(`CheckboxValidatorV3:\t answer is not valid`) } /** diff --git a/src/app/utils/field-validation/validators/common.ts b/src/app/utils/field-validation/validators/common.ts index bedfd98595..a096463c23 100644 --- a/src/app/utils/field-validation/validators/common.ts +++ b/src/app/utils/field-validation/validators/common.ts @@ -66,7 +66,7 @@ export const makeSignatureValidator: ( const { signature, answer } = response if (!signature) { return left( - `CommonValidator.makeSignatureValidator:\t answer does not have valid signature`, + `CommonValidator.makeSignatureValidator:\t answer signature is missing`, ) } const isSigned = @@ -102,8 +102,9 @@ export const makeSignatureValidatorV3 = } const { value, signature } = response.answer if (!signature) { + // TODO: (FM-1688) Remove this log after sure that validation logic works as expected. return left( - `CommonValidatorV3.makeSignatureValidator:\t answer does not have valid signature`, + `CommonValidatorV3.makeSignatureValidator:\t answer signature is missing. value: ${value}, signature: ${signature}`, ) } const isSigned = @@ -117,7 +118,8 @@ export const makeSignatureValidatorV3 = return isSigned ? right(response) - : left( - `CommonValidatorV3.makeSignatureValidator:\t answer does not have valid signature`, + : // TODO: (FM-1688) Remove this log after sure that validation logic works as expected. + left( + `CommonValidatorV3.makeSignatureValidator:\t answer does not have valid signature. value: ${value}, signature: ${signature}`, ) }