Skip to content

Commit

Permalink
fix: backport from collective/volto-form-block#122 (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk authored and pnicolli committed Dec 20, 2024
1 parent 43fc8f2 commit 8312f5e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/customizations/volto-form-block/components/View.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 8312f5e

Please sign in to comment.