Open adfec opened 8 years ago
Need to say, I used moment.js as says the documentation, the code above is wrong
Same issue here
@adfec The documentation here isn't really very clear on (a) how this actually works and (b) how you then reformat the date to pass back to the server-side. Would you mind posting a clear example?
@iamfinky I solved it this way:
$( '.datetimepicker' ).datetimepicker( {timepicker:false,format:'Y/m/d'} ).on( 'blur', function(){
$( this ).val( moment( $( this ).val() ).format('YYYYMMDD') );
});
When the component has another date format instead of "d/m/Y" and you click outside the element, it replace the date you previously selected with the current date.
I got the issue with this declaration:
$( '.datetimepicker' ).datetimepicker( { timepicker: false, format: 'Ymd' } );