From 4b7f80977a31b26e0015a0885ab07f9b740bbcc9 Mon Sep 17 00:00:00 2001 From: Quentin Aupetit Date: Mon, 10 Feb 2025 11:45:44 -0400 Subject: [PATCH] Release v1.32.2 (#264) --- CHANGELOG.md | 10 +++++++++- package-lock.json | 4 ++-- package.json | 2 +- src/components/form/fields/birthdayField.tsx | 16 +--------------- src/components/form/fields/dateField.tsx | 4 ++-- tests/components/form/fields/dateField.test.tsx | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60b4d58..f42d623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.32.2] - 2025-02-10 + +### Fixed + +- Fix date field value format + ## [1.32.1] - 2025-02-06 ### Fixed @@ -566,7 +572,9 @@ The eye icon is now correctly displayed in the Auth widget. First version of the SDK Web UI. -[Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/1.32.1...HEAD +[Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/1.32.2...HEAD + +[1.32.2]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.32.1...v1.32.2 [1.32.1]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.32.0...v1.32.1 diff --git a/package-lock.json b/package-lock.json index 4d5c780..a5e2b1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@reachfive/identity-ui", - "version": "1.32.1", + "version": "1.32.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@reachfive/identity-ui", - "version": "1.32.1", + "version": "1.32.2", "license": "MIT", "dependencies": { "@reachfive/identity-core": "^1.35.1", diff --git a/package.json b/package.json index 2e153ae..2e1c1cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@reachfive/identity-ui", - "version": "1.32.1", + "version": "1.32.2", "description": "ReachFive Identity Web UI SDK", "author": "ReachFive", "repository": { diff --git a/src/components/form/fields/birthdayField.tsx b/src/components/form/fields/birthdayField.tsx index 2ccd32d..937801f 100644 --- a/src/components/form/fields/birthdayField.tsx +++ b/src/components/form/fields/birthdayField.tsx @@ -1,9 +1,8 @@ -import { differenceInYears, formatISO, isValid, parseISO } from "date-fns" +import { differenceInYears } from "date-fns" import dateField from './dateField' import { Validator } from '../../../core/validation'; import { Config } from '../../../types'; -import { isRichFormValue } from "../../../helpers/utils"; export const ageLimitValidator = (min = 6, max = 129) => new Validator({ rule: (value) => { @@ -21,19 +20,6 @@ export default function birthdateField( return dateField({ ...props, label: label, - format: { - bind: (value) => { - const dt = value ? parseISO(value) : undefined - return dt && isValid(dt) ? { raw: dt } : undefined - }, - unbind: (value) => { - return isRichFormValue(value, 'raw') - ? formatISO(value.raw, { representation: 'date' }) - : value - ? formatISO(value, { representation: 'date' }) - : null - } - }, validator: ageLimitValidator(min, max) }, config) } diff --git a/src/components/form/fields/dateField.tsx b/src/components/form/fields/dateField.tsx index 7694ca0..c0db511 100644 --- a/src/components/form/fields/dateField.tsx +++ b/src/components/form/fields/dateField.tsx @@ -221,9 +221,9 @@ export default function dateField( }, unbind: (value) => { return isRichFormValue(value, 'raw') - ? formatISO(value.raw) + ? formatISO(value.raw, { representation: 'date' }) : value - ? formatISO(value) + ? formatISO(value, { representation: 'date' }) : null } }, diff --git a/tests/components/form/fields/dateField.test.tsx b/tests/components/form/fields/dateField.test.tsx index ed299af..ad1c9d1 100644 --- a/tests/components/form/fields/dateField.test.tsx +++ b/tests/components/form/fields/dateField.test.tsx @@ -174,7 +174,7 @@ describe('DOM testing', () => { expect(onSubmit).toBeCalledWith( expect.objectContaining({ - date: formatISO(new Date(year, month, day)) // value is formatted in handler data + date: formatISO(new Date(year, month, day), { representation: 'date' }) // value is formatted in handler data }) )