react-datetime
react-datetime copied to clipboard
Format value from input type=“datetime-local” for react-datetime
I'm Submitting a ...
[x] Bug report
[ ] Feature request
[x] Support request
Steps to Reproduce
I need to use input type='datetime-local' in Datetime component, so I added inputProps={{ type: 'datetime-local' }} there. input type='datetime-local' needs to have some specific format for value like yyyy-MM-ddThh:mm, so I added format for date
var date = moment().format('YYYY-MM-DDTHH:mm');
React.render(
<Datetime locale="ru"
value={date}
//onChange={setFilter}
closeOnSelect={true}
dateFormat='YYYY-MM-DD'
timeFormat='hh:mm'
inputProps={{ type: 'datetime-local' }}
/>,
document.body
);
There are no problems with choosing date, but when I'm trying to set time, I get some random date and can't choose any time at all.
Expected Results
Actual Results
Minimal Reproduction of the Problem
I've tried to reproduce the problem, but there it doesn't work at all - it doesn't allow to choose any date or time. https://codepen.io/anon/pen/KRYEyZ
Other Information (e.g. stacktraces, related issues, suggestions how to fix)
Maybe it is possible to change format of value from yyyy-MM-ddThh:mm to yyyy-MM-dd hh:mm before passing it to calendar?