Skip to content

Commit 95ce1d0

Browse files
committed
Fixed editable fields issue caused by date parsing in the general code
1 parent ec9e54f commit 95ce1d0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/components/Renderer/Body/Date.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Date = ({
2323
<Row padding="0 0 5px">
2424
<Datetime
2525
name={ name }
26-
onChange={ handleChange }
26+
onChange={(value) => handleChange(moment(value).format(parse))}
2727
modified={ isModified }
2828
className={ isModified ? 'modified' : ''}
2929
value={ datetime.format(inputFormat) }

src/hoc/withData.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useSelector, shallowEqual } from 'react-redux';
44
import ConfigContext from '../context';
55
import { createSelector } from 'reselect';
66
import { MODIFY_DATA } from '../actions';
7-
import moment from 'moment';
87

98
const withData = WrappedComponent => (props) => {
109
const { itemIndex, colConfig, primaryKey, schema } = props;
@@ -31,13 +30,20 @@ const withData = WrappedComponent => (props) => {
3130
(item) => _.get(item, name)
3231
));
3332

34-
const handleChange = (value) => {
33+
const handleChange = (eventOrValue) => {
34+
let value = null;
35+
if (eventOrValue.target) {
36+
value = eventOrValue.target.value;
37+
} else {
38+
value = eventOrValue;
39+
}
40+
3541
return (
3642
action(MODIFY_DATA)({
3743
pk: primaryKey,
3844
pkValue: primarKeyValue,
3945
key: name,
40-
value: moment(value).format(parse)
46+
value: value
4147
})
4248
);
4349
}

0 commit comments

Comments
 (0)