From 9dd4cc9351fa046b2d2876646e774b1493407d6b Mon Sep 17 00:00:00 2001 From: Alexander Saiannyi Date: Mon, 5 Aug 2024 15:26:54 +0200 Subject: [PATCH] refactor(core): update date form field --- .../addresses-content/address-field-handlers.ts | 2 +- .../register-customer-form/fields/date.tsx | 11 ++++++++--- .../fields/radio-buttons.tsx | 16 ++++++++-------- core/components/ui/date-picker/date-picker.tsx | 1 + 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/app/[locale]/(default)/account/[tab]/_components/addresses-content/address-field-handlers.ts b/core/app/[locale]/(default)/account/[tab]/_components/addresses-content/address-field-handlers.ts index d0f2a0acad..db87be2a78 100644 --- a/core/app/[locale]/(default)/account/[tab]/_components/addresses-content/address-field-handlers.ts +++ b/core/app/[locale]/(default)/account/[tab]/_components/addresses-content/address-field-handlers.ts @@ -162,7 +162,7 @@ const createRadioButtonsValidationHandler = const createDatesValidationHandler = (dateStateSetter: FieldStateSetFn, dateFieldState: FieldState) => (e: React.ChangeEvent) => { - const fieldId = Number(e.target.id.split('-')[1]); + const fieldId = Number(e.target.name.split('-')[2]); const validationStatus = e.target.validity.valueMissing; dateStateSetter({ ...dateFieldState, [fieldId]: !validationStatus }); diff --git a/core/app/[locale]/(default)/login/register-customer/_components/register-customer-form/fields/date.tsx b/core/app/[locale]/(default)/login/register-customer/_components/register-customer-form/fields/date.tsx index 601f497842..b46fd7a0eb 100644 --- a/core/app/[locale]/(default)/login/register-customer/_components/register-customer-form/fields/date.tsx +++ b/core/app/[locale]/(default)/login/register-customer/_components/register-customer-form/fields/date.tsx @@ -72,13 +72,18 @@ export const DateField = ({ return (
- + {field.label} - + - -