From fba445c8a905ffa5e145c032ff1ada5a371d7c47 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Wed, 7 Aug 2019 00:44:07 +0300 Subject: [PATCH] Fixed date time issue --- src/components/dateTimePicker/view/dateTimePickerView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/dateTimePicker/view/dateTimePickerView.js b/src/components/dateTimePicker/view/dateTimePickerView.js index 09b513b18..56b0ebf95 100644 --- a/src/components/dateTimePicker/view/dateTimePickerView.js +++ b/src/components/dateTimePicker/view/dateTimePickerView.js @@ -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; }