Created
April 28, 2018 20:01
-
-
Save dangrossman/d50376f3467f69e7fb5570afd07dc921 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
<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> |
How could I implement this on React ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?