This happens using dateTimePicker and moment.js:
If I use this line code:
console.info($('#inp_date_time_'+value.fila+'_id').val());
print this date format:
04/09/2015 08:31
then If I use this line code:
moment($('#inp_date_time_'+value.fila+'_id').val()).format('YYYY-DD-MM HH:mm:ss');
print this date format:
2015-09-04 08:31:00
and it's ok, but If I select a day more bigger that 12 (example : 13/09/2015)
I have "invalid date" , I think that take the days like months , or I don't know.
How can I fix this?, sorry my english.
Better option would be to specify
dateFormat
when creating amoment
object. So replacemoment($('#inp_date_time_'+value.fila+'_id').val()).format('YYYY-DD-MM HH:mm:ss');
withmoment($('#inp_date_time_'+value.fila+'_id').val(),, 'DD/MM/YYYY HH:mm').format('YYYY-DD-MM HH:mm:ss')
;