Closed pablougas closed 8 years ago
This was a pain in the a**! So I hope this helps someone using cocoon gem in the future!
<script> $(document).on("mouseover mouseout", ".datetimepicker", function(){ $(this).datetimepicker({ format:'YYYY-MM-DD hh:mm:00 a' }) }); $('form').submit( function () { $('.datetime').each( function() { $(this).val(moment(new Date($(this).val())).format("YYYY-MM-DD HH:mm:ss")) console.log($(this).val()); }); }) </script>
This was a pain in the a**! So I hope this helps someone using cocoon gem in the future!