-
-
Save bobvandevijver/9e05f1340b23c27c8794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
var $field = $('#new_admingeneratorbundle_activity_start_participants'); | |
var $widget = $('#'+$field.attr('id')+'_widget'); | |
var config = {"locale": "nl","format": "DD-MM-YYYY HH:mm","useCurrent": false,"sideBySide": true,"stepping": 5,"icons": {"time": "fa fa-clock-o","date": "fa fa-calendar","up": "fa fa-arrow-up","down": "fa fa-arrow-down"}}; | |
$widget.datetimepicker(config); | |
$widget.data("DateTimePicker").date(moment("22-07-2015 13:46", "DD-MM-YYYY HH:mm")); | |
var copyValue = function() { | |
var date = $widget.data("DateTimePicker").date(); | |
if(date == null) $field.val('') | |
else $field.val(moment(date).format("DD-MM-YYYY HH:mm")); | |
}; | |
$widget.on("dp.change", copyValue); | |
$widget.find('a.s2a-date-btn').on('click', function(e){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
$widget.data("DateTimePicker").show(); | |
}); | |
$widget.find('a.s2a-clear-btn').on('click', function(e){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
$widget.data("DateTimePicker").date(null); | |
$widget.trigger("dp.change"); | |
}); | |
$field.closest('form').on('submit', copyValue); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment