Skip to content

Commit 0b4b1cb

Browse files
authored
fix: fix formatInputValue ignoring format (#7170)
1 parent d3678b0 commit 0b4b1cb

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/decap-cms-widget-datetime/src/DateTimeControl.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,9 @@ class DateTimeControl extends React.Component {
114114
formatInputValue(value) {
115115
if (value === '') return value;
116116
const { format, inputFormat } = this.getFormat();
117-
let formattedValue = this.isUtc
118-
? dayjs.utc(value).format(inputFormat)
119-
: dayjs(value).format(inputFormat);
120-
if (!this.isValidDate(formattedValue)) {
121-
formattedValue = this.isUtc
122-
? dayjs.utc(value, format).format(inputFormat)
123-
: dayjs(value, format).format(inputFormat);
124-
}
125-
return formattedValue;
117+
return this.isUtc
118+
? dayjs.utc(value, format).format(inputFormat)
119+
: dayjs(value, format).format(inputFormat);
126120
}
127121

128122
handleChange = datetime => {

0 commit comments

Comments
 (0)