Skip to content

Commit

Permalink
Merge pull request #7865 from opengovsg/release_v6.159.0
Browse files Browse the repository at this point in the history
build: release v6.159.0
  • Loading branch information
kevin9foong authored Nov 7, 2024
2 parents 96fcd29 + 02fbd76 commit 55f8fa6
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 22 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.158.2",
"version": "6.159.0",
"homepage": ".",
"type": "module",
"private": true,
Expand Down
13 changes: 9 additions & 4 deletions frontend/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
}

/**
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions shared/types/field/dateField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/app/utils/field-validation/validators/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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 =
Expand All @@ -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}`,
)
}

0 comments on commit 55f8fa6

Please sign in to comment.