Fixed date time issue

This commit is contained in:
Mustafa Buyukcelebi 2019-08-07 00:44:07 +03:00
parent e1e2c8f928
commit fba445c8a9

View File

@ -40,7 +40,7 @@ class DateTimePickerView extends PureComponent {
}
if (date && _value) {
const formatedDateTime = new Date(`${date} ${_value}`).toISOString();
const formatedDateTime = moment(`${date} ${_value}`, 'YYYY-MM-DD HH:mm').toISOString();
onSubmit(formatedDateTime);
this._initState();
}
@ -55,11 +55,11 @@ class DateTimePickerView extends PureComponent {
if (type === 'date-time') {
_type = date ? 'time' : 'date';
_format = date ? 'HH:MM' : 'YYYY-MM-DD';
_format = date ? 'HH:mm' : 'YYYY-MM-DD';
_minDate = date ? null : moment().format('YYYY-MM-DD');
} else {
_type = type;
_format = type === 'date' ? 'YYYY-MM-DD' : 'HH:MM';
_format = type === 'date' ? 'YYYY-MM-DD' : 'HH:mm';
_minDate = type === 'date' ? moment().format('YYYY-MM-DD') : null;
}