| <input type="text" name="datefilter" value="" /> | |
| <script type="text/javascript"> | |
| $(function() { | |
| $('input[name="datefilter"]').daterangepicker({ | |
| autoUpdateInput: false, | |
| locale: { | |
| cancelLabel: 'Clear' | |
| } | |
| }); | |
| $('input[name="datefilter"]').on('apply.daterangepicker', function(ev, picker) { | |
| $(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY')); | |
| }); | |
| $('input[name="datefilter"]').on('cancel.daterangepicker', function(ev, picker) { | |
| $(this).val(''); | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
dimitrisscript commentedFeb 18, 2019
If this is supposed to start with a blank date, why does:
$('input[name="datefilter"]').data('daterangepicker').startDate.format('YYYY-MM-DD');return today's date instead of null?