From 8312f5e60c695cfe2bf0ebc8aced4ec5a83a8055 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Fri, 20 Dec 2024 11:08:08 +0100 Subject: [PATCH] fix: backport from https://github.com/collective/volto-form-block/pull/122 (#834) --- .../volto-form-block/components/View.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/customizations/volto-form-block/components/View.jsx b/src/customizations/volto-form-block/components/View.jsx index e48b80141..4ebce2c85 100644 --- a/src/customizations/volto-form-block/components/View.jsx +++ b/src/customizations/volto-form-block/components/View.jsx @@ -1,5 +1,6 @@ // CUSTOMIZATION: // - added warning state to form +// - backport for https://github.com/collective/volto-form-block/pull/122 import React, { useState, useEffect, useReducer, useRef } from 'react'; import { useSelector, useDispatch } from 'react-redux'; @@ -8,7 +9,6 @@ import { useIntl, defineMessages } from 'react-intl'; import { submitForm, resetOTP } from 'volto-form-block/actions'; import { getFieldName } from 'volto-form-block/components/utils'; import FormView from 'volto-form-block/components/FormView'; -import { formatDate } from '@plone/volto/helpers/Utils/Date'; import config from '@plone/volto/registry'; import { Captcha } from 'volto-form-block/components/Widget'; import { isValidEmail } from 'volto-form-block/helpers/validators'; @@ -260,20 +260,21 @@ const View = ({ data, id, path }) => { config.blocks.blocksConfig.form.attachment_fields.includes( subblock.field_type, ); - const isDate = subblock.field_type === 'date'; + // const isDate = subblock.field_type === 'date'; if (isAttachment) { attachments[name] = formattedFormData[name].value; delete formattedFormData[name]; } - if (isDate) { - formattedFormData[name].value = formatDate({ - date: formattedFormData[name].value, - format: 'DD-MM-YYYY', - locale: intl.locale, - }); - } + // XXX: dates should be sent as ISO format, not DD-MM-YYYY ! + // if (isDate) { + // formattedFormData[name].value = formatDate({ + // date: formattedFormData[name].value, + // format: 'DD-MM-YYYY', + // locale: intl.locale, + // }); + // } } }); dispatch(