Skip to content

Instantly share code, notes, and snippets.

@dangrossman
Last active November 9, 2021 16:41
Show Gist options
  • Save dangrossman/98d8f1c304328c191b1ad33ac21354fd to your computer and use it in GitHub Desktop.
Save dangrossman/98d8f1c304328c191b1ad33ac21354fd to your computer and use it in GitHub Desktop.
<input type="text" name="birthday" value="10/24/1984" />
<script>
$(function() {
$('input[name="birthday"]').daterangepicker({
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
maxYear: parseInt(moment().format('YYYY'),10)
}, function(start, end, label) {
var years = moment().diff(start, 'years');
alert("You are " + years + " years old!");
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment