fix(widget-date): allow empty value (#2705)
This commit is contained in:
parent
dde1f27536
commit
d058697644
@ -89,7 +89,7 @@ export default class DateControl extends React.Component {
|
||||
* Otherwise produce a date object.
|
||||
*/
|
||||
if (format) {
|
||||
const formattedValue = moment(datetime).format(format);
|
||||
const formattedValue = datetime ? moment(datetime).format(format) : '';
|
||||
onChange(formattedValue);
|
||||
} else {
|
||||
const value = moment.isMoment(datetime) ? datetime.toDate() : datetime;
|
||||
|
@ -74,7 +74,7 @@ export default class DateTimeControl extends React.Component {
|
||||
* Otherwise produce a date object.
|
||||
*/
|
||||
if (format) {
|
||||
const formattedValue = moment(datetime).format(format);
|
||||
const formattedValue = datetime ? moment(datetime).format(format) : '';
|
||||
onChange(formattedValue);
|
||||
} else {
|
||||
const value = moment.isMoment(datetime) ? datetime.toDate() : datetime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user