From c9f59abaf2cf5e141c73f986c525659d380a356b 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/parse-fields.ts | 2 +- .../fields/radio-buttons.tsx | 16 ++++++++-------- core/components/ui/date-picker/date-picker.tsx | 1 + 5 files changed, 19 insertions(+), 13 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..241019118e 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.id.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..234575fc46 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} - + - -